0

I have a file with some lines of length 485 and some with 501 I need to separate them based on length of the line into two files one containing only those lines having length as 485 and other file having all the lines having length 501

Hemant
  • 94
  • 6

1 Answers1

0

Using awk (Linux/OSX):

awk '{if(length($0) == 485) { print $0 }}' in.txt > 485.txt
awk '{if(length($0) == 501) { print $0 }}' in.txt > 501.txt
tonys
  • 3,855
  • 33
  • 39