[Solved] sed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [Solved] sed
# 1  
Old 11-29-2012
[Solved] sed

Code:
sed -e 's/console/raw/g'

this command will replace the letter pradeep with rawat
what if i want to replace a word like FRIENDS with a space simultaneously from the same file i m replacing pradeep. im doing this
Code:
sed -e 's/console/raw/g' && sed 's/FRIENDS//g'

but i dono why this is not happening.

Last edited by Scott; 11-29-2012 at 04:43 AM.. Reason: Please use code tags and a descriptive subject title next time. Thanks.
# 2  
Old 11-29-2012
Please use code tags.
Also, please use more descriptive titles for your threads.
Quote:
Originally Posted by console
sed -e 's/console/raw/g'
this command will replace the letter pradeep with rawat
I see neither pradeep nor rawat in the script. Please copy/paste intelligently.

May be you need this:
Code:
sed -e 's/console/raw/g;s/FRIENDS//g' file

This User Gave Thanks to elixir_sinari For This Post:
# 3  
Old 11-29-2012
Quote:
Originally Posted by console
sed -e 's/console/raw/g'
this command will replace the letter pradeep with rawat
what if i want to replace a word like FRIENDS with a space simultaneously from the same file i m replacing pradeep. im doing this
sed -e 's/console/raw/g' && sed 's/FRIENDS//g'
Please use code tags for code and data sample.

I don't think so..

How come sed -e 's/console/raw/g' will replace pradeep with rawat..???Smilie

for multiple simultaneous substitution use.

Code:
sed -e 's/console/raw/g; s/FRIENDS/ /g' file

@Elixir - Congrats. You were faster..Smilie.. (i m lit bit late..Smilie)

Last edited by pamu; 11-29-2012 at 04:49 AM.. Reason: cross post..
This User Gave Thanks to pamu For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[Solved] sed command help

Hello all. Im trying very hard to figure this out, but Im a newbie. I have a file that looks like this.... 6315551234 NJ224 5162224567 SUFF Im trying to put a command together that will make it into this.... UM,6315551234,,,,,NJ224,0 UM,5162224567,,,,,SUFF,0 Im all over the... (7 Replies)
Discussion started by: jay11789
7 Replies

2. Shell Programming and Scripting

[Solved] String manuplation using sed

Hello All, I have a file that has following contents ... config INY_DEBUG bool "Debug" default n source mod/ati/Kconfig source mod/spi/Kconfig source mod/kgi/Kconfig source mod/mei/Kconfig source mod/cai/Kconfig source mod/stormi/Kconfig I have a shell variable ... (6 Replies)
Discussion started by: anand.shah
6 Replies

3. Shell Programming and Scripting

[solved] sed append into .bashrc

Hi all, I'm trying to do a basic append into /home/joe/.bashrc: /usr/bin/test -z `sudo /bin/grep umask /home/joe/.bashrc` && sudo /bin/sed -i '/PATH=/a \ umask 0022 ' /home/joe/.bashrc I run this as user floren with full root privileges in sudoers. For some reason, the first command is... (1 Reply)
Discussion started by: TECK
1 Replies

4. Shell Programming and Scripting

[SOLVED] sed -i not available in solaris 5.10

Hi All, i'm writing a script where i have to grep for a pattern and the 3 lines after the pattern and comment them out. Note that i have to do this for multiple files, i am able to grep the pattern and the next 3 lines but since solaris does not recognize the -i option, i was wondering if... (11 Replies)
Discussion started by: Irishboy24
11 Replies

5. Shell Programming and Scripting

[SOLVED] sed command

Help request, I have tsted this line of code for hours. The first line works and the second line returns the message " sed: command garbled.....". This is running on solaris. The "${} variables all have good values when echoed. ## /bin/sed -n '1,25p' ${file} >> ${MailFile} ... (3 Replies)
Discussion started by: millerg225
3 Replies

6. UNIX for Dummies Questions & Answers

[solved]Help with a sed command

So I have a bunch of strings in a file. Example Line ./prcol/trt/conf/conf-app/jobdefinition/trt-pre-extr-trt-step.jdef Intended Result pre-extr-trt-step So far I have parsed it out to the last bit, echo $line | cut -d'/' -f7 | cut -d. -f1Result trt-pre-extr-trt-step So I added a... (2 Replies)
Discussion started by: J-Man
2 Replies

7. Shell Programming and Scripting

[solved] how to separate using sed !

dears, hope evryone doing good in his work , i have a question about something important : how can i use 'sed' so in a script automatically it will take an enter before the number 1 in this line so 2 commands will be taken insted of one big command ?... (0 Replies)
Discussion started by: semaan
0 Replies

8. Shell Programming and Scripting

Solved: AWK SED HELP

Hi, I need to process a file as below. Could you please help to achieve that using awk/sed commands. Input file: --------------- AB | "abcdef 12345" | 7r5561451.pdf PQRST | "fghfghf hgkjgtjhghb ghhgjhg hghjghg " | 76er6ry.pdf 12345 | "fghfgcv uytdywe bww76 jkh7dscbc 78 : nvchtry hbuyt"... (0 Replies)
Discussion started by: viveksr
0 Replies

9. Shell Programming and Scripting

Solved - Sed - Positional Replace

Hi All, I don't know what I am doing wrong in the regex below. I have the following string: 31000000010201005181121360000000100000000003000000YYY-YYY-YYY-20100518-104139.txt.YYY I need to split it in parts: - Group 1: 3100000001020100518112136 - Group 2: 000000010 - Group 3:... (0 Replies)
Discussion started by: felipe.vinturin
0 Replies

10. Shell Programming and Scripting

can this been solved with awk and sed?

Hi Masters, ___________________________________________________________________________________ Group of orthologs #1. Best score 3010 bits Score difference with first non-orthologous sequence - yeast:3010 human:2754 YHR165C 100.00% PRP8_HUMAN 100.00%... (16 Replies)
Discussion started by: mskcc
16 Replies
Login or Register to Ask a Question