Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to loop files in linux from svn status

As being quite a newbie in linux, I have the follwing question. I have list of files (this time resulting from svn status) and i want to create a script to loop them all and replace tabs with 4 spaces.

So I want from

....
D      HTML/templates/t_bla.tpl
M      HTML/templates/t_list_markt.tpl
M      HTML/templates/t_vip.tpl
M      HTML/templates/upsell.tpl
M      HTML/templates/t_warranty.tpl
M      HTML/templates/top.tpl
A  +   HTML/templates/t_r1.tpl
....

to something like

for i in <files>; expand -t4;do cp $i /tmp/x;expand -t4 /tmp/x > $i;done;

but I dont know how to do that...

like image 597
eddy147 Avatar asked Nov 29 '22 12:11

eddy147


1 Answers

You can use this command:

svn st | cut -c8- | xargs ls

This will cut the first 8 characters leaving only a list of file names, without Subversion flags. You can also add grep before cut to filter only some type of changes, like /^M/. xargs will pass the list of files as arguments to a given command (ls in this case).

like image 187
Adam Byrtek Avatar answered Dec 06 '22 10:12

Adam Byrtek