code_junkie

Counting no. of Delimiter in a row in a File in Unix

Nov 13th, 2011
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. awk -F '|' 'NF != 35 {print NR, $0} ' your_filefile
  2.  
  3. cat records.txt | perl -ne '$t = $_; $t =~ s/[^|]//g; print unless length($t) == 35;'
  4.  
  5. while read n; do [ `echo $n | tr -cd '|' | wc -c` != 35 ] && echo $n; done < records.txt
Add Comment
Please, Sign In to add comment