Blond moment : sed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Blond moment : sed
# 1  
Old 09-23-2014
Blond moment : sed

Hallo Team,

I have thousands of lines and i would like to manilpute a pattern but i am getting an error:

File lo0ks like below:
Code:
pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:pax1.csv:BW-CDR-20140102072500-2-AC162DB137C8-087691-000.csv_rejected_6023193-20140922220503.log:BW-CDR-20140102072500-2-AC162DB137C8-087691-000.csv_rejected_6023193-20140922220503.log:BW-CDR-20140923122117-2-AC162DB137C8-087691-000.csv_rejected_4885609-20140923122117.log:BW-CDR-20140923122117-2-AC162DB137C8-087691-000.csv_rejected_4885609-20140923122117.log:BW-CDR-20140923113000-2-AC162DB137C8-163773-000.csv_rejected_6025049-20140923123430.log:0106160684AC162DB137C820140923092630.7910+020000,ROCHESTER,Normal,+27117946268,,Originating,+27117946268,Public,0748896483,20140923092630.791,0+020000,Yes,20140923092639.365,20140923092745.804,016,VoIP,,0748896483,national,mobi,0748896483,,local,10.0.110.11:5060,BW112630794230914744741167@196.35.130.5,G729/8000,196.209.59.224,290c539c-4cb3ae1b7ff00f693f9b0800234f5a2e@192.168.1.103,,,,HIP-ROCHESTER-NORTHGATE,,,,,,,,,,y,public,,4152469853:0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0117946268@isvoip.net,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72.275,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Network,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0117946268@isvoip.net,Primary Device,72.275,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Panasonic_KX-TGP500B01/22.58 (0800234f5a2e),,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,|Y,ACCOUNT NOT FOUND (9)

My command is like below:

Code:
-bash-3.2$ sed -i '/*pax1.csv:BW-CDR/BW-CDR/g' pax1.csv
sed: -e expression #1, char 15: unknown command: `B'
-bash-3.2$ sed -i '/*pax1.csv:BW/BW-CDR/g' pax1.csv
sed: -e expression #1, char 15: unknown command: `B'

# 2  
Old 09-23-2014
did you miss '
Code:
s/

Code:
sed -i 's/*pax1.csv:BW-CDR/BW-CDR/g' pax1.csv

This User Gave Thanks to itkamaraj For This Post:
# 3  
Old 09-23-2014
I think you mean s/a/b/g or the like.

Those lines are extremely long. You may not be able to match them unless you are using GNU sed.
# 4  
Old 09-23-2014
)(*&^% blond moment. Thanx Kamaraj

---------- Post updated at 04:12 PM ---------- Previous update was at 04:00 PM ----------

i celebrated too soon. Corona please explain how can this be achieved i am running redhat linux 5
# 5  
Old 09-23-2014
step 1: use linux.

So you're probably OK.
# 6  
Old 09-23-2014
/g (multiple substitution attempts per line) is certainly not needed.
The * is crappy. Perhaps it is treated as a literal character that does not match here.
.* means any number of characters (to be matched and substituted).
Perhaps you want to replace the pax1.csv: before the BW-CDR
Code:
sed -i 's/pax1.csv:BW-CDR/BW-CDR/' pax1.csv

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

I am learning regular expression in sed,Please help me understand the use curly bracket in sed,

I am learning SED and just following the shell scripting book, i have trouble understanding the grep and sed statement, Question : 1 __________ /opt/oracle/work/antony>cat teledir.txt jai sharma 25853670 chanchal singhvi 9831545629 anil aggarwal 9830263298 shyam saksena 23217847 lalit... (7 Replies)
Discussion started by: Antony Ankrose
7 Replies

2. Shell Programming and Scripting

sed and awk giving error ./sample.sh: line 13: sed: command not found

Hi, I am running a script sample.sh in bash environment .In the script i am using sed and awk commands which when executed individually from terminal they are getting executed normally but when i give these sed and awk commands in the script it is giving the below errors :- ./sample.sh: line... (12 Replies)
Discussion started by: satishmallidi
12 Replies

3. What is on Your Mind?

What is your favourite movie at the moment?

Hi, guys. What is your favourite movie at the moment? Which movie are you watching? I am watching the Thor:) (17 Replies)
Discussion started by: Tinna
17 Replies

4. Homework & Coursework Questions

2. Write a shell script that produces some summary information of the system at a particular moment

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 2. Relevant commands, code, scripts, algorithms: 3. The attempts at a solution (include all... (2 Replies)
Discussion started by: jsk319342
2 Replies

5. OS X (Apple)

OS 10 lässt sich nicht mehr installieren...ubuntu läuft als system im moment....hilfe!

hello, I have installed on my MacBookPro Ubuntu via Boot Camp, but bootcamp has deletet that MacOS partion and created just one new and installed ubuntu. Now I can not install MacOS 10 from the DVD, the gray screen comes when I use the "C" key during the boot process. it starts booting... (2 Replies)
Discussion started by: ingwio
2 Replies

6. Shell Programming and Scripting

Any one here this moment? (Ignore)

I have small question i should solve it (1 Reply)
Discussion started by: Ame
1 Replies

7. Shell Programming and Scripting

sed over writes my original file (using sed to remove leading spaces)

Hello and thx for reading this I'm using sed to remove only the leading spaces in a file bash-280R# cat foofile some text some text some text some text some text bash-280R# bash-280R# sed 's/^ *//' foofile > foofile.use bash-280R# cat foofile.use some text some text some text... (6 Replies)
Discussion started by: laser
6 Replies

8. Shell Programming and Scripting

Issue with a sed one liner variant - sed 's/ ; /|/g' $TMP1 > $TMP

Execution of the following segment is giving the error - Script extract:- OUT=$DATADIR/sol_rsult_orphn.bcp TMP1=${OUT}_tmp1 TMP=${OUT}_tmp ( isql -w 400 $dbConnect_OPR <<EOF select convert(char(10), s.lead_id) +'|' + s.pho_loc_type, ";", s.sol_rsult_cmnt, ";", +'|'+ s.del_ind... (3 Replies)
Discussion started by: kzmatam
3 Replies

9. UNIX for Dummies Questions & Answers

is there any way to know how much time process was running from the moment it started

i have process that was started few days ago , is there way to know by its id how long it was alive in the system ? Thanks (2 Replies)
Discussion started by: umen
2 Replies
Login or Register to Ask a Question