How to print sed results

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to print sed results
# 8  
Old 06-30-2011
Are you replacing the MY_STR1 to MY_STR2 ?

i guess, you are missing s in the sed command

The below code writes the output to output.txt
find ./ -type f|xargs sed 's/MY_STR1/MY_STR2/' > output.txt

Once you confirm the changes, you can modifiy the file by using sed -i
This User Gave Thanks to itkamaraj For This Post:
# 9  
Old 06-30-2011
Dear itkamaraj,

I tested sed command, so I don't need to check again (my command take a very long time to run, so I don't want to run twice).

But I need the output to check and report later.
# 10  
Old 06-30-2011
try this.. i dont know whether it will capture the output or not.

just give a try.

find ./ -type f|xargs sed -i '/MY_STR1/MY_STR2/' | tee output.txt

but, when you use sed -i it will not show the file contents.
# 11  
Old 06-30-2011

It does not work :-(

Anyway, thank you very much for your help
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search for names in one list in another and print results

Hi All , New to the Bash / Shell programming world and looking for some help I have two files 1: Contains a list of names : eg STEVE BOB CRAIG 2: Contains information with those included names but also others that are not in the list (1 Reply)
Discussion started by: Lonerg550
1 Replies

2. Shell Programming and Scripting

Parsing OSX UNIX command results which print in multiple lines

from the CLI on a Mac, if you type networksetup -listallnetworkservices then you get results in a multi-line paragraph that look something like this: networksetup -listallnetworkservices An asterisk (*) denotes that a network service is disabled. Wi-Fi Display Ethernet Bluetooth DUN... (7 Replies)
Discussion started by: hungryd
7 Replies

3. Shell Programming and Scripting

Narrowing sed Results in While Loop

find $SRC -type f -name *.emlx | while read FILE do if : then sed -n '/From/p' $FILE fi done > $DEST-output.txt The loop above spits out a .txt file with several lines that look like this: From: John Smith <> How can I narrow that sed result to spit out the email... (5 Replies)
Discussion started by: sudo
5 Replies

4. UNIX for Dummies Questions & Answers

How to print results from two lines using awk?

I need to print a specific string from an html file that's always occurring between two other known strings. Example: from the text below, I would like to print the bolded part: <this is a lot of text before the string I want to print> fullpath: abc/def/ghi/example.xlf -cfver. <sample text... (15 Replies)
Discussion started by: danegon
15 Replies

5. Shell Programming and Scripting

how to print off results

print from an ip_list file containing 300 ip's the directory of the results is /var/tmp/ the will change according to the /tmp/ip_list file i.e I need the results from /var/tmp/ once done the script goes to the next ip address in... (11 Replies)
Discussion started by: slashbash
11 Replies

6. Shell Programming and Scripting

Print some results in a text file using script in linux

hello everyone, i really need your help to write a script which would just print following kind of result into a text file (result.txt) XYZ test Results ID: <unique-id> Date: <date> ------------------------------------------------- | Task | Result | Time |... (3 Replies)
Discussion started by: viriimind
3 Replies

7. Shell Programming and Scripting

Script template for inputting filenames and print results

Hi, Hope you are all well. New to scripting, and all those characters are all a new language for me. Though hoping to get my little head round it all sooner or later. I was wondering whether anyone could help with a script template example. What I would like to happen is to run the script... (8 Replies)
Discussion started by: loky27
8 Replies

8. Shell Programming and Scripting

print first few lines, then apply regex on a specific column to print results.

abc.dat tty cpu tin tout us sy wt id 0 0 7 3 19 71 extended device statistics r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device 0.0 133.2 0.0 682.9 0.0 1.0 0.0 7.2 0 79 c1t0d0 0.2 180.4 0.1 5471.2 3.0 2.8 16.4 15.6 15 52 aaaaaa1-xx I want to skip first 5 line... (4 Replies)
Discussion started by: kchinnam
4 Replies

9. Shell Programming and Scripting

Print just 1 results from the whole line

Hi All, need some help with writing a shell script. I tried to search this forum but couldn't find exactly what i want. If you all know any reference link i can read and refer to solve my issue, let me know. I got 1 file i.e: example.txt. It is content list of data, as below example. What... (2 Replies)
Discussion started by: anakiar
2 Replies

10. Shell Programming and Scripting

search file and print results with shell script

Discussion started by: dodasajan
3 Replies
Login or Register to Ask a Question