You are not logged in.
Pages: 1
Hello all,
I wasn't sure where to put this so if it needs moving, mods please feel free to do so.
I'm trying to write a shell script and have hit a dead end. Despite googling everything I can think of I have come up short. I'm trying to create a script to take a text file and process it for me. By this I mean, copy lines with certain data, remove any spaces or tabs and trim out extra garbage. It's the last step I am stuck with...
I need to find a way to copy a string of text that varies to a new file, I'm working with web addresses to get that out in the open. Ideally I need a command or sequence of them to take a string starting with http and ending with .jpg (I'll adapt for other extensions later) and place all the excerpts from the file into a fresh one ready for passing through wget.
Any help or pointers is much appreciated,
Thanks in advance,
Jon
Offline
Getting all of a certain kind of string is easier with grep -o than sed because of multiple hits per line, e.g. grep -o 'http[^ ]*jpg' file.html
Offline
Thanks Procyon that's exactly what i was searching for.
Jon
Offline
Pages: 1