home.


Tagged: unix-paste


Paste from the linux/unix command line into graphical applications

If you’ve got a large file on the command line, a large CSV file or whatever, you may want to paste that into a graphical application, like Firefox, via the clipboard.

If you install xclip you can do this easily.

cat somelargefile.txt | xclip --selection clipboard

The --selection clipboard saves it to the paste buffer you use in graphical applications. There are others available.

unix unix-paste xclip

Unix commands: cut and paste

cat textfile | cut -d$'\t' -f1

This will separate fields in textfile by a tab character, and display only the first field. (Only works in bash, not plain sh, due to $‘\t’ I believe)

cat textfile | paste -s --delimiters=','

This will join all the lines in a text file (-s) using the delimiter ‘,’.

unix unix-cut unix-paste

Page 1 of 1