Bash question
Terrence Enger
tenger-P1ovA8G34VBEfu+5ix1nRw at public.gmane.org
Wed Dec 21 03:12:33 UTC 2011
On Tue, 2011-12-20 at 20:08 -0500, jim wrote:
>
> I want to take all the files that have the same 7 digit numbers at the
> front end of the file names
Jim,
You might try something like this, with changes of course, to fit your
situation ...
ls -1 \
| grep --extended-regexp '^[[:digit:]]{6}.*\.pdf' \
| grep --only-match --extended-regexp '^[[:digit:]]{7}' \
| uniq \
| xargs -L1 -I theNumber \
bash -c 'eval echo "Do something clever with files ... theNumber* "'
Note how neatly the `echo` command at the end of that sidesteps the
question of how one joins PDF files. That question came up on this
list a couple of weeks ago.
HTH,
Terry.
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list