Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

usage of sed command

Status
Not open for further replies.

sivamanikandan

Newbie level 4
Joined
Jun 20, 2012
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,309
i found a script in whch sed is used like this
sed -e 's#\(.*).log#\mv & \1_bak.log#'|sh
actually what operaion this will do?
 

i found a script in whch sed is used like this
sed -e 's#\(.*).log#\mv & \1_bak.log#'|sh
actually what operaion this will do?

Someone is being a bit silly, as there is no need for the -e option here.

It is some sort of substitution, as

s/foo/bar

will substitute foo for bar, but I'm surprised in your example there is no / after the first s. The whole thing looks a bit odd to me, but it seems they are probably trying to rename a file from a .log extension to a 1_bak.log. There is a usenet group, something like comp.unix.shell. I sugget you ask there.

Deborah
 

if you get a input as "
abc.log
def.log
..........",
then the first pipeline will substitute it for "
mv abc.log abc_bak.log
mv def.log def_bak.log
...........".
shell reads the output from sed, and executes as commands

- - - Updated - - -

s/foo/bar/ s#foo#bar# s!foo!bar! those work too
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top