I have a text file like:
"10","server","","11111",JLB,
I need a way to say if the 3rd field has data in it, move the contents of the entire line to a new file.
Any ideas?
Thanks,
I have a text file like:
"10","server","","11111",JLB,
I need a way to say if the 3rd field has data in it, move the contents of the entire line to a new file.
Any ideas?
Thanks,
Hi.
awk -F, '$3 ~ /^"..*"/ { print > FILENAME "_" C++ }' file1
when I run this, I get no output - on the screen or in a file.
awk -F, 'length($3)>2' oldfile > newfile
On Solaris try nawk, not awk.
Based on your input, I created a file (file1):
"10","server","","11111",JLB,
"10","server","A","11111",JLB,
"10","server","B","11111",JLB,
After the script runs, I have file1_0 and file1_1 with:
"10","server","B","11111",JLB,
"10","server","B","11111",JLB,
respectively.
Seeing Jim's "> 2" makes me think "keep it simple"! (and Solaris? was my next question)
Thanks, Jim. That worked great. And yes, this is Solaris.