The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
retrieved multiple lines on multiple places in a file dala Shell Programming and Scripting 8 03-14-2008 11:28 AM
error: initializer expression list treated as compound expression arunchaudhary19 High Level Programming 12 11-16-2007 02:44 AM
Expression for Finding Multiple Directories..?? meskue Shell Programming and Scripting 3 07-10-2006 12:04 PM
How to choose Multiple process or Multiple threads? ashleykumar IP Networking 0 04-10-2006 03:30 AM
Regular Expression + Aritmetical Expression Z0mby Shell Programming and Scripting 2 05-21-2002 07:59 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #8 (permalink)  
Old 05-15-2008
era era is online now
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,631
Stumble this Post!
"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?)
Reply With Quote
Forum Sponsor
  #9 (permalink)  
Old 05-15-2008
Registered User
 

Join Date: May 2008
Posts: 51
Stumble this Post!
should be korn shell
Reply With Quote
  #10 (permalink)  
Old 05-15-2008
era era is online now
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,631
Stumble this Post!
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?
Reply With Quote
  #11 (permalink)  
Old 05-15-2008
Registered User
 

Join Date: May 2008
Posts: 51
Stumble this Post!
Quote:
grep -v '[=-(]' test.txt
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
Reply With Quote
  #12 (permalink)  
Old 05-15-2008
era era is online now
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,631
Stumble this Post!
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

Code:
grep -v '[-=(]' file

Last edited by era; 05-15-2008 at 11:48 PM. Reason: Or move to beginning or end of class
Reply With Quote
  #13 (permalink)  
Old 05-16-2008
Registered User
 

Join Date: May 2008
Posts: 51
Stumble this Post!
thanks era, your method works however.


erm, i got another question though

Quote:
xxx 254 xx 40 HC M U02 25 6 4 0
*space* xx 20 GP H U02 27 3 1 0
*space* xx 20 GP U U02 27 3 1 0
*space* xx 40 HC X U02 25 4 3 0
*space* xx 40 HC U U02 25 6 1 0
*space* xx 20 GP L U02 27 3 1 0
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'?
Reply With Quote
  #14 (permalink)  
Old 05-16-2008
era era is online now
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,631
Stumble this Post!
Different question, different thread. Also try to explain it better. "Before" and "after" samples are often instructive.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
solaris

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:13 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0