Guest User

Untitled

a guest
Jul 15th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. text1;text2;text3;text4
  2. ...
  3.  
  4. awk -F';' -v col=$col -v pat="$val" '$col ~ pat' $input
  5.  
  6. cat text_file.txt| cut -d';' column_num | grep pattern
  7.  
  8. #!/usr/bin/env python
  9. import sys
  10. column = 1 # the column to search
  11. value = "the data you're looking for"
  12. with open("your file","r") as source:
  13. for line in source:
  14. fields = line.strip().split(';')
  15. if fields[column] == value:
  16. print line
  17.  
  18. egrep "^([^;]+;){`expr $col - 1`}$value;([^;]+;){`expr 3 - $col`}([^;]+){`expr 4 - $col`}$" filename
  19.  
  20. egrep "^([^;]+;){`expr $col - 1`}$value(;|$)" filename
Add Comment
Please, Sign In to add comment