removing semicolon using sed in aix--urgent


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers removing semicolon using sed in aix--urgent
# 1  
Old 06-16-2008
removing semicolon using sed in aix--urgent

hi

I have an expression


aaabbb; xxx xxxi

i need to get the ouput as

xxx xxxi

i am using sed -e 's/\(*;\)//g' but it is not working..??

can some one suggest..

This is urgent
# 2  
Old 06-16-2008
Your sed syntax is incorrect.

Code:
sed -e 's/.*;//' file

In regular expression syntax, dot (.) means "any character (other than newline)" and asterisk (*) means "the previous regular expression zero or more times". A sole asterisk is a syntax error.
# 3  
Old 06-16-2008
The semicolon (";") is a special character in sed, which means "end of command". For instance you can write

Code:
sed 's/a/b/
     s/c/d'

or

Code:
sed 's/a/b;s/c/d/'

which would be the same. Instead of using the next line for the next command the semicolon separates the commands the same.

Either escape it (by preceding it with a backslash: "\;") or use a character class: "[;]". A square bracket means "any of the characters inside", like "[aou]" would mean either an "a" or an "o" or a "u". Inside the square brackets all characters lose their special meaning too, so in effect it is the same as escaping them.

I hope this helps.

bakunin
# 4  
Old 06-16-2008
Code:
 echo "aaabbb; xxx xxxi" |  sed -e 's/\(.*;\)//g'

think you missed a . as in .*
# 5  
Old 06-16-2008
hey i tried all the solutions mentioned in the reply...
it is replacing my whole string..

i mean along with aaabbb; xxx xxxi is also getting removed!!!
so iam in a fix!
# 6  
Old 06-16-2008
Quote:
Originally Posted by bakunin
The semicolon (";") is a special character in sed, which means "end of command".
At least in my version of sed, it's not special inside a regular expression. But maybe AIX is different.
# 7  
Old 06-16-2008
Try using cut command

Try cut command as follows

cut -f 2 -d ';'

eg:
$echo "aaabbb; xxx xxix"|cut -f 2 -d ';'
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace semicolon within double quotes in a file with semicolon delimiter

Hello Team, Could you please help me with the below question? I have a file with the following properties 1) File Delimiter is ; 2) Text columns are within double quotes 3) Numeric columns will not have double quotes 4) File has total 6 columns Please see a sample record from file ... (3 Replies)
Discussion started by: sam99
3 Replies

2. AIX

Python on AIX-Need urgent Help

Hi Experts, I am new to python and AIX. I am trying to install Python 2.7 or python 3.2 on AIX 7.1 but getting the bellow error. could you please let me know how to resolve this. Note: Same has been installed on Linux Redhat successfully. $ ./configure --enable-shared ##... (1 Reply)
Discussion started by: Tamil_Arasan
1 Replies

3. UNIX for Dummies Questions & Answers

Delete a semicolon and numbers after a semicolon

I have this: ((9:0.010,(11:0.089,13:0.004)) and I would like this: ((A9,(A11,A13)) How do I delete the semi colon and the number (i.e. 0.010) after the semi colon? Also, how can I add the letter before the number that is NOT removed? Thank you in advance! ---------- Post updated... (4 Replies)
Discussion started by: MDeBiasse
4 Replies

4. AIX

Need Help Urgent AIX Hang

hello all, I'm newbie on AIX. Can any one tell why this happen ? I have expectation this error came because paging memory. This is my error : ( I cann;t read this log and need your help) --------------------------------------------------------------------------- LABEL: ... (7 Replies)
Discussion started by: Fandikurnia
7 Replies

5. AIX

Urgent!! Debugging tool for cobol in AIX

hi folks, I am a new to Aix, i worked as sys admin so no idea about software probs, my software team requires Debugging tool for cobol in AIX machine. can someone tell me the tool and also the installation procedure for the same Please drag me out from this soon :confused: (1 Reply)
Discussion started by: atulgkwd
1 Replies

6. Shell Programming and Scripting

Removing commas within semicolon in a flat file

i am recieving a flat file ( comma seperated ) with comma in between double quotes in any of the source fields . i need to remove the comma in double quotes and process the file thereafter fields in file ========= col1,col2,col3,col4 input can be any of the followng... (31 Replies)
Discussion started by: r_t_1601
31 Replies

7. Shell Programming and Scripting

Removing commas within semicolon in a flat file

Hi , Im relatively new to unix and have to process a comma serparated flat file . I recieve some of the fields in double quotes and i want to remove it .. INPUT ==== filed1,field2,field3,"fie,ld4" OUTPUT ===== field1,field2,field3,"field4" can anyone tell me how to achieve... (10 Replies)
Discussion started by: r_t_1601
10 Replies

8. AIX

URGENT: zip utility on AIX 5.x

Do you know where can I find the 'zip' binary utility for AIX 5.x ? I have the zip-2.3.0.0.bff file, but I don't have root access and I want to test the 'zip' utility. Thank you !!! (2 Replies)
Discussion started by: V3l0
2 Replies

9. AIX

(URGENT) Mounting JFS2 FileSystem on AIX 4.3

Hi Every body, I created Volume Group & FileSystem of type JFS2 with size 1.3 TB on AIX 5.2. I want to import this VG on another system AIX 4.3. It is imported successfully & I can varyon the VG but unfourtantly I couldn't mount the FileSystem. Is it possible to mount a JFS2 FileSystem on AIX... (3 Replies)
Discussion started by: aldowsary
3 Replies
Login or Register to Ask a Question