this is the content of the file:
i want to remove both the line starting with "=" and "(" but i can only remove one at a time..so how do I go about removing both of them?
this is the content of the file:
i want to remove both the line starting with "=" and "(" but i can only remove one at a time..so how do I go about removing both of them?
One way:
awk '!/^\=+/ && !/^\(/ ' your_file
Something like this?
grep -v '^[(=]' inputfile > outputfile
now i got another problem
my dashes "---" "---" are not at the first line, and iwant to remove them as well
however when i try to do this:
it won;t remove the dashes at all
can you please explain the pattern to me?
and it says event not found
To remove the dashes too, use:
awk '!/^\=+|^\(|^\-+/' your_file
If your OS doesn't recognize awk , try nawk or /usr/xpg4/bin/awk on solaris.
it recognizes awk, but it doesn't recognizes '/^\' this particular pattern
"Event not found" is a message from your shell. You need to use different quoting (though I don't understand how it could say that if you use single quotes; which shell are you using?)
should be korn shell
If you are on Solaris or HP-UX, did you try looking for nawk or XPG4 awk?
The grep command above should work, as such. The dash between = and ( in the command you tried seems misplaced; does it help if you take it out? How exactly is the result wrong?
you mean this?
my dashes are not at the first position, in fact it's a certain distance away from the 1st position of the line, having some spaces in between
when i do that command above, it still doesn't remove the dashes, that's all
That command should remove any line which contains an equals sign, or an opening parenthesis; the dash you put between also causes it to remove all lines which contain a character whose ASCII code falls between those two, in theory; however, ( comes before = in ASCII so I guess it doesn't really change anything (but could also be the reason you're not getting it to work). Take out the dash and try again? Or move it first or last in the class, like
grep -v '[-=(]' file
thanks era, your method works however.
erm, i got another question though
the file indentation for that part is actually like that as of above (well almost, the xx is align with the xx). However, different files has different number of line for that.
However, after the data is done showing, the next line will always be a empty space (or "\n" if what you guys call it)
so how do I extract those data and ignore the 'x254'?
Different question, different thread. Also try to explain it better. "Before" and "after" samples are often instructive.
oh ok, I go create another thread
sed '/^=/d;/^(/d;' filename