how to remove lines with variable value
Hi frds,
I have model output data in ascii format. It contains thousands of lines. The output file contains multiple text lines with variable values. here I copy-paste some of it's contents. Code:
73438 170 23:53:20 3.481328E-03 1.824611E+04 1.824612E+04 1.333962E+16 and so on i want to remove the lines starting by WRT and DEF. so how can do it..please help. Thanking you Mahesh |
Welcome to LinuxQuestions! Are you running ROMS? ;)
Code:
sed -r '/^DEF|^WRT/d' file |
Thanks for the reply. Yes I am running ROMS model.
mahesh |
If you have Perl installed
#!/usr/bin/perl use warnings; open ( IH, '<', './path_to _your_file') or die "$!\n"; open ( OH, '>', './your_output_filename') or die "$!\n"; while (<IH>) { next if /^DEF/; next if /^WRT/; print OH; } __END__ |
Quote:
|
Quote:
Code:
sed -r '/DEF_|WRT_/d' roms.log PS: I've edited your post adding CODE tags to preserve the spacing of the original text, so that it's more evident where the problem comes from. |
Not being familiar with ROMS logs, are we sure that DEF_ and WRT_ won't appear anywhere else in the line?
If they might you can cover white space with: Code:
sed -r '/^[[:space:]]*(DEF_|WRT_)/d' roms.log |
Quote:
|
All times are GMT -5. The time now is 10:27 AM. |