SED-Question - OR and Output in new file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SED-Question - OR and Output in new file
# 1  
Old 05-28-2010
SED-Question - OR and Output in new file

Hi i want connect several sed-commands with an OR and get the output in a new file.
I thought it works with sed ... | sed ... | sed ... > file , but it doesn`t work.
Can anyone help me?

regards
alex
# 2  
Old 05-28-2010
Hi Alex,

I am a begineer.

I think the -e option will help u a bit..

Please try the below command as mentioned below:

sed -e 's/a/A/' -e 's/b/B/' <old >new

Thanks,
Deepak
# 3  
Old 05-28-2010
Quote:
Originally Posted by alexander_
Hi i want connect several sed-commands with an OR and get the output in a new file.
I thought it works with sed ... | sed ... | sed ... > file , but it doesn`t work.
Can anyone help me?

regards
alex
please elaborate on the "doesn't work" part.
# 4  
Old 05-28-2010
Hi,

for a better understanding ... i have the following commands:

Code:
cat /file.xml | \ sed '0,/<text>/d'  | sed '/<\/text>/,/<text>/d' |  sed 's/<[^>]\+>//g'  > file2.txt

i want to take the file.xml - do some sed-commands and get the result in file2.txt
But i get always : invalid escape-string

alex

Last edited by vgersh99; 05-28-2010 at 10:30 AM.. Reason: code tags, please!
# 5  
Old 05-28-2010
Quote:
Originally Posted by alexander_
Hi,

for a better understanding ... i have the following commands:

Code:
cat /file.xml | \ sed '0,/<text>/d'  | sed '/<\/text>/,/<text>/d' |  sed 's/<[^>]\+>//g'  > file2.txt

i want to take the file.xml - do some sed-commands and get the result in file2.txt
But i get always : invalid escape-string

alex
Code:
cat /file.xml | \ sed '0,/<text>/d'  | sed  '/<\/text>/,/<text>/d' |  sed 's/<[^>]\+>//g'  >  file2.txt

what is '\'?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Getting output with sed without writing to a file

HI I am trying to grep 3 characters from hostname and append a character at the end. I tried as in the following: root@abag3:~# hostname | cut -c1-3 hyu Now I am trying to append "g" at the end of this output as in the following. root@abag3:~# hostname | cut -c1-3 | sed -s... (4 Replies)
Discussion started by: Priya Amaresh
4 Replies

2. Shell Programming and Scripting

Insert output from a file to beginning of line with sed

Hi I've been trying to search but couldn't quite get the answer I was looking for. I have a a file that's like this Time, 9/1/12 0:00, 1033 0:10, 1044 ... 23:50, 1050 How do I make it so the file will be like this? 9/1/12, 0:00, 1033 9/1/12, 0:10, 1044 ... 9/1/12, 23:50, 1050 I... (4 Replies)
Discussion started by: diesel88
4 Replies

3. UNIX for Advanced & Expert Users

Using awk or sed need the output in the new file

Please find the input file as given below: 2012/02/29 11:00:00~~CRITICAL~For customer 00000476 no daily files were found in the 010137933 account directory. 2012/02/29 11:00:00~~CRITICAL~For customer 05006802 no daily files were found in the 010115166 account directory. 2012/02/29... (0 Replies)
Discussion started by: av_sagar
0 Replies

4. Shell Programming and Scripting

output redirection to existing file question

So I have a existing file that I used the uniq command on and I need to save the output to the same file without changing the file name. I have tried $ uniq filename > filename then when I cat the file it then becomes blank like there is nothing inside. any help would be much appreciated... (0 Replies)
Discussion started by: drew211
0 Replies

5. Shell Programming and Scripting

Output file question

I am running a shell script which executes a bteq script and the output of the BTEQ script is dumped in the standard output file. The output of the bteq execution is a table with 30 columns and the width of the output would be about 800 characters for each record. My current output only shows 3... (3 Replies)
Discussion started by: Mihirjani
3 Replies

6. Shell Programming and Scripting

Sed does not make changes in the file but to the standard output

I have an xml file. I am doing some change, say deleting line 770. File name is file.xml. I use: sed '770d' file.xml but this does not actually make changes in the *file* but shows the changes on standard output (screen) if i use $var=`sed '770d' file.xml` echo $var > file.xml this... (3 Replies)
Discussion started by: indianjassi
3 Replies

7. Shell Programming and Scripting

Question about output to file

Hi, I am try to setup a FOR loop script to find out all the existing linux workstations in the network w/ ip address, hostname and linux version. I created a basic FOR loop script: for i in $(seq 1 254) do echo 10.72.169.$i >> result ssh -o ConnectTimeout=3 root@10.72.169.$i "hostname"... (1 Reply)
Discussion started by: beeloo
1 Replies

8. UNIX for Dummies Questions & Answers

using awk or sed to print output from one file

dear i have one file regarding >abshabja>sdksjbs>sknakna>snajxcls so i want to be output like >abshabja >sjkabjb >sknakna >snajxcls Any using awk or sed will help thanks (2 Replies)
Discussion started by: cdfd123
2 Replies

9. Shell Programming and Scripting

appending to sed output of one file into the middle of file

hi, i have a file file1 file2 ----------- ----------------- aa bbb ccc 111 1111 1111 ddd eee fff 222 3333 4444 ggg hhh... (5 Replies)
Discussion started by: go4desperado
5 Replies

10. UNIX for Dummies Questions & Answers

SED Question -- on appending to a file

:confused: I have a script that Cats a flat database file which contains 12 columns into sed. I want to add a 13th column which includes " ,2005-08-29 " * The date needs to be the current date. This 13th column would be appended to the end of each line. Does anyone have a clue... (5 Replies)
Discussion started by: Redg
5 Replies
Login or Register to Ask a Question