Quote:
Originally Posted by verona
and I need to end up with :
//blah/blah/blah/123.txt 123
//blah/blah/blah/blah/456.txt 456
//blah/blah/789.txt 789
|
Indeed, sed seems a good way of doing this.
In the pattern part of sed 's/pattern/substitution/':
- Find a regular expression that matches the filenames you're interested in (such as 456.txt).
- Use escaped parentheses to store the part of the matches you're interested in.
In the substitution part:
- Use \0 to print the entire match and \1 to print the stored part.
I'm not sure about your exact requirements, but maybe this is a place to start from: cat input | sed 's/\/\([0-9]*\)\.txt$/\0 \1/g'
Regards
dmdeb