need help on multiple expression


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting need help on multiple expression
# 8  
Old 05-16-2008
"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?)
# 9  
Old 05-16-2008
should be korn shell
# 10  
Old 05-16-2008
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?
# 11  
Old 05-16-2008
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
# 12  
Old 05-16-2008
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-16-2008 at 03:48 AM.. Reason: Or move to beginning or end of class
# 13  
Old 05-16-2008
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'?
# 14  
Old 05-16-2008
Different question, different thread. Also try to explain it better. "Before" and "after" samples are often instructive.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Multiple substitutions in one expression using sed

Hi, I'm trying to get multiple substitutions in one expression using sed: echo "-foo-_-bar--foo-_bar_-_foo_bar_-foo_-_bar_-" | sed -e "s//-/g" So, as you can see I'm trying to replace all instances of _-, -_, -- with - (dash) I have provided bad example. The question is how to use multiple... (6 Replies)
Discussion started by: useretail
6 Replies

2. Shell Programming and Scripting

Regular expression to match multiple lines?

Using a regular expression, I would like multiple lines to be matched. By default, a period (.) matches any character except newline. However, (?s) and /s modifiers are supposed to force . to accept a newline and to match any character including a newline. However, the following two perl... (4 Replies)
Discussion started by: LessNux
4 Replies

3. Shell Programming and Scripting

Why Relational Expression is Writing to a Expression?

Hello All, Not sure why this is happening... When the following If Statement is evaluated for some reason it is creating a file in the CWD called '0'. I've seen this happen before, just not in an If Statement... CODE: if then DIR_NAME="$1" DIR_SIZE=0 STATUS="" else... (3 Replies)
Discussion started by: mrm5102
3 Replies

4. Shell Programming and Scripting

regular expression grouping across multiple lines

cat book.txt book1 price 23 sku 1234 auth Bill book2 sku 1233 price 22 auth John book3 auth Frank price 24 book4 price 25 sku 129 auth Tod import re f = open('book.txt', 'r') text = f.read() f.close() m =... (2 Replies)
Discussion started by: chirish
2 Replies

5. UNIX for Advanced & Expert Users

sed: -e expression #1, char 0: no previous regular expression

Hello All, I'm trying to extract the lines between two consecutive elements of an array from a file. My array looks like: problem_arr=(PRS111 PRS213 PRS234) j=0 while } ] do k=`expr $j + 1` sed -n "/${problem_arr}/,/${problem_arr}/p" problemid.txt ---some operation goes... (11 Replies)
Discussion started by: InduInduIndu
11 Replies

6. Shell Programming and Scripting

Integer expression expected: with regular expression

CA_RELEASE has a value of 6. I need to check if that this is a numeric value. if not error. source $CA_VERSION_DATA if * ] then echo "CA_RELESE $CA_RELEASE is invalid" exit -1 fi + source /etc/ncgl/ca_version_data ++ CA_PRODUCT_ID=samxts ++ CA_RELEASE=6 ++ CA_WEEK_NO=7 ++... (3 Replies)
Discussion started by: ketkee1985
3 Replies

7. UNIX for Dummies Questions & Answers

Define multiple expression to single array?

This is fine and workinga = "A/A" How to define some thing like this ??? a = "A/A" or "T/T or some thing else (2 Replies)
Discussion started by: stateperl
2 Replies

8. Programming

error: initializer expression list treated as compound expression

I had seen this error for the first time ..... error: initializer expression list treated as compound expression please help.... (12 Replies)
Discussion started by: arunchaudhary19
12 Replies

9. Shell Programming and Scripting

Expression for Finding Multiple Directories..??

I am writing a shell script to search for previous versions of an application...the application is called TAU and basically i want to search the users home directory and /Applications for any instances of a "TAU" folder.. If found i want to give the user the option to remove the old folders and if... (3 Replies)
Discussion started by: meskue
3 Replies

10. Shell Programming and Scripting

Regular Expression + Aritmetical Expression

Is it possible to combine a regular expression with a aritmetical expression? For example, taking a 8-numbers caracter sequece and casting each output of a grep, comparing to a constant. THX! (2 Replies)
Discussion started by: Z0mby
2 Replies
Login or Register to Ask a Question