find a null value in a row/column and delete entire row
hey guys..
my source looks like this 1 a g 2 j f 352 k i 4 g r 4 b 4 f k 4 l 5 c d 5 k 5 r j i want to delete the 5th,7th and 9th row as it contains null in second column i am newbie to linux so i would appreciated any kind of help. thanks |
Hi and welcome to LQ!
Please put your script/data inside [code] ... [/code] tags it preserves all spacing. If you don't know how: LQ - BB Code List. The example given in your first post looks the same for all entries, using code tags might give a better view on your problem. Hope this helps |
thanks druuna
here i am highlighting the rows that have to be removed 1 a g 2 j f 352 k i 4 g r 4 b 4 f k 4 l 5 c d 5 k 5 r j |
I can't understand your problem very well !!
|
@umix: As stated in my previous reply: You need to use [code] [/code] tags around your example!
|
ok i got it
Code:
1 a g |
Try out this
Code:
awk -F" " ' $2 != "" { print } ' /path/to/your/file > /path/to/the/desired/file |
Hi,
tshikose's solution doesn't work when using your example , try one of these: Code:
# using awk: Hope this helps. |
Let us keep it simple:
Code:
awk 'NF > 2' infile > outfile |
thanks a lot for all valuable suggestions..it helped me to solve
|
Remember to mark as SOLVED.
|
All times are GMT -5. The time now is 06:01 AM. |