SED, AWK or PERL HELP
I have files with entries like this:
Yamaha__4 .EPS Yamaha__5 .EPS Yamaha__6 .EPS Yamaha__7 .EPS Yamaha__8 .EPS Yamaha__9 .EPS York_ .EPS York__2 .EPS York__3 .EPS I need to have the .EPS to be on the previous line with the file name: so Yamaha__4 .EPS Would become Yamaha__4.EPS I think it has something to do with a newline feature, any suggestions on how to go through a few files and fix this? Thanks, Eric |
How about
Code:
$ grep -v ".EPS" your-file | awk '{printf("%s.EPS",$0);} > newfile' |
Code:
sed -i -e'/EPS/ d' -e's/$/\.eps/g' <yourfile> Tink P.S.: One question: looking at http://www.linuxquestions.org/questi...der=descending I have that suspicion this all might be homework stuff? You seem to have an awful lot of weird files that need conversion... |
Quote:
It is important to note that the clients did spend one day trying to manually rename these files in Windows, it took one person 8 hours to rename 300 files. For them to rename these 17,000 files in this attempt, it would take almost 60 full 8 hour days, 480 man hours to do this task, $10 per hour would be $5,000; $20 per hour would be $10,000, we wanted to save them time and money and demonstrate the resourcefulness of Open Source products, needless to say they are very impressed. Thanks. |
Thanks for the explanation, it's just that I've answered
a few of your queries over the last few weeks, seen others answer more, and you only ever come back with different questions. Btw, I'm sure that others would appreciate a "thanks", and maybe some sort of feed-back whether their solutions worked for you, too. You know, this place is driven by volunteers, and to just come in and abuse us as a free problem-solving machine, specially when you get money for it (you did say "your customers", right?) appears a bit rude. Cheers, Tink |
You are right, I should express my thanks in the previous posts, I will remember to do that in the future. And to all members out there who have helped me in the past, I appreciate your time and support.
I just also wanted to mention, as I did in my last post, that once all of this is done and over with, I intended on providing a case study or tutorial on how to batch rename thousands of files to unique file names. Is this not a way to say thanks? Giving back to the community? This all sounds familiar somehow? I don't think I am the rude one here, read your last post. By the way I work for "The MAN", so I did not profit from it in any way other than the knowledge. |
This code just joins every other line in a file to the previous line.
sed '$!N;s/\n//' filelist |
All times are GMT -5. The time now is 08:25 AM. |