I have a file of thousands of records. In column 87 it can contain 001, 002, 003, or 004. I need a quick easy way to create an output with all the records greater than 002. What unix command can do this? Or, do I need to write a quick program.
Unix Record Extract by Column Value
Collapse
X
-
If there are no column separator, how do you recognize that 001 is in column 87?
Can you put here some data from that datafile and show where do you think 87th column is.Comment
-
You can use the cut (-b) command and specify what position in the string that you want to look at...From there you can use an if statement:
Just for a start...Code:for i in `cat <file>` do section=`echo ${i} | cut -b 87-89` if [[ ${section} == "003" -o ${section} == "004" then echo ${section} fi doneComment
Comment