Jay McGavren's Journal

2007-10-17

cat and control-d...

My latest way to make Windows play nice with Linux is to paste in files via the terminal. I do:

$ cat > file.txt
[pasted content]
^D
$

That Control-D ends the file and puts me back at a prompt, with [pasted content] saved safely in file.txt.

Well, I just realized the same thing will work with xargs. I had some noisy terminal output that contained some file names I needed to delete. I copied it out, pasted it to my favorite text editor, played around with it until only file names were left, and then did this:

$ cat | xargs rm
[pasted file names]
^D
$

And voila - the files are gone. I haven’t used this (or xargs) extensively, so try at your own risk, but it seems to work nice so far.

comments powered by Disqus