need help on multiple expression


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting need help on multiple expression
# 1  
Old 05-15-2008
need help on multiple expression

this is the content of the file:

Quote:
AutoMicro Job Request
================================
(1). Job Request Information
================================
Date of Request: 20080514 10:37 Submitted By: xxx
First Carrier: xxx Date of Process: 20080514 10:38

================================
(2). Plan Summary By Connection
================================
| Previous | | Current |
Conn Total Plan Usr Prev Can Has
Vsl Voy Type Qty Qty Plan Plan Plan Plan Reason**
--- --- ---- ----- --- ---- ---- ---- ---- ------
xxx 254 xxx 11 0 0 0 11 11
**Reason: [P]: Cannot Plan Fully [O]: Not In Planning Scope [C]: No Cluster
[B]: Big Volume [I]: Band 1 HLD Connection [S]: Not Selected
[N]: No BKDN to Plan [H]: Holding Volume Too High [F]: No Feasible space

==========================================
(3). Plan Details For Connecting Carriers
==========================================
Vsl Voy Port Sz Cat Wt Block Slot Row Qty Crane OperCode ResvFor
xxx 254 xx 40 HC M U02 25 6 4 0
xx 20 GP H U02 27 3 1 0
xx 20 GP U U02 27 3 1 0
xx 40 HC X U02 25 4 3 0
xx 40 HC U U02 25 6 1 0
xx 20 GP L U02 27 3 1 0
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?
# 2  
Old 05-16-2008
Quote:
Originally Posted by finalight
...
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:

Code:
awk  '!/^\=+/ && !/^\(/ '  your_file

# 3  
Old 05-16-2008
Something like this?

Code:
grep -v '^[(=]' inputfile > outputfile

# 4  
Old 05-16-2008
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:

Quote:
grep -v '[=-(]' test.txt
it won;t remove the dashes at all
# 5  
Old 05-16-2008
Quote:
Originally Posted by rubin
One way:

Code:
awk  '!/^\=+/ && !/^\(/ '  your_file

can you please explain the pattern to me?

and it says event not found
# 6  
Old 05-16-2008
To remove the dashes too, use:

Code:
awk '!/^\=+|^\(|^\-+/' your_file

If your OS doesn't recognize awk , try nawk or /usr/xpg4/bin/awk on solaris.
# 7  
Old 05-16-2008
it recognizes awk, but it doesn't recognizes '/^\' this particular pattern
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