Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
73439 170 23:56:40 3.481210E-03 1.824611E+04 1.824612E+04 1.333962E+16
73440 171 00:00:00 3.481093E-03 1.824611E+04 1.824612E+04 1.333962E+16
DEF_HIS - creating history file: /share/scratch/odc/mahesh/roms_files/output/rmed16_grd_e/GLS/his_rmed16_grd_gls_0171.nc
WRT_HIS - wrote history fields (Index=1,1) into time record = 0000001
DEF_DIAGS - creating diagnostics file: /share/scratch/odc/mahesh/roms_files/output/rmed16_grd_e/GLS/dia_rmed16_grd_gls_0170.nc
WRT_DIAGS - wrote diagnostics fields into time record = 0000001
WRT_RST - wrote re-start fields (Index=1,1) into time record = 0000002
73441 171 00:03:20 3.480976E-03 1.824611E+04 1.824612E+04 1.333962E+16
73442 171 00:06:40 3.480859E-03 1.824611E+04 1.824612E+04 1.333962E+16
73443 171 00:10:00 3.480742E-03 1.824611E+04 1.824612E+04 1.333962E+16
..
..
..
..
..
..
..
73871 171 23:56:40 3.435554E-03 1.824611E+04 1.824611E+04 1.333962E+16
73872 172 00:00:00 3.435464E-03 1.824611E+04 1.824611E+04 1.333962E+16
DEF_HIS - creating history file: /share/scratch/odc/mahesh/roms_files/output/rmed16_grd_e/GLS/his_rmed16_grd_gls_0172.nc
WRT_HIS - wrote history fields (Index=1,1) into time record = 0000001
DEF_DIAGS - creating diagnostics file: /share/scratch/odc/mahesh/roms_files/output/rmed16_grd_e/GLS/dia_rmed16_grd_gls_0171.nc
WRT_DIAGS - wrote diagnostics fields into time record = 0000001
WRT_RST - wrote re-start fields (Index=1,1) into time record = 0000002
73873 172 00:03:20 3.435374E-03 1.824611E+04 1.824611E+04 1.333962E+16
73874 172 00:06:40 3.435284E-03 1.824611E+04 1.824611E+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.
What is not working? And what is not working means? Actually in the ROMS log the DEF_ and WRT_ keywords are not written at the beginning of the line, hence the sed command should be simply:
Code:
sed -r '/DEF_|WRT_/d' roms.log
without the ^ anchor that identifies the beginning of the line.
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:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.