use the list of files stored in a text file and process it

SJ Wright sjwright68@charter.net
Thu Sep 30 14:25:00 GMT 2010


albert kao wrote:
> I store a list of files in a text file (test.txt) on Windows XP.
> I want to use the list of files and process it (e.g. ls).
> What is the command to do that?
> I tried the following commands but to no avail.
>
> $ cat test.txt
> test.txt
>
> $ cat test.txt | xargs ls
> : No such file or directory
>
> $ cat test.txt | xargs -delimiter="\n" ls
> xargs: Invalid input delimiter specification elimiter=\n: the delimiter must be 
> either a single char
> acter or an escape sequence starting with \.
>
> $ cat test.txt | xargs -delimiter='\n' ls
> xargs: Invalid input delimiter specification elimiter=\n: the delimiter must be 
> either a single char
> acter or an escape sequence starting with \.
>
> $ cat test.txt | xargs -delimiter='\\n' ls
> xargs: Invalid input delimiter specification elimiter=\\n: the delimiter must be 
> either a single cha
> racter or an escape sequence starting with \.
>
> $ cat test.txt | xargs -delimiter="\\n" ls
> xargs: Invalid input delimiter specification elimiter=\n: the delimiter must be 
> either a single char
> acter or an escape sequence starting with \.
>
> $ uname -srv
> CYGWIN_NT-5.1 1.7.5(0.225/5/3) 2010-04-12 19:07
>
>
>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>
>
>   
I would also suggest that you check your filenames in test.txt to make 
sure, if you included paths, that they are absolute and follow the 
Cygwin virtual-paths (cygpath) syntax, i.e.: /cygdrive/c/... or 
/etc/share/... and so on. Barring that, a path in Unix notation relative 
to your $PWD -- or the directory where test.txt is saved -- is a good 
starting point (npi): something along the lines of bin/deprecated or 
../man1 .

I know one of the trip-ups I often have if I spend any time away from a 
L/Unix environment has to do with the "mv" command: I often forget that 
it prefers absolute paths from root folders (or in the case of Cygwin, 
virtual ones taken as real) or dot-dot-slash relative path syntax to 
just "/god-directory/" or what-have-you. Many other commands, 
particularly ls and ln -s, are likewise "particular about their paths."

Steve W.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list