I have a file (with only 1 column) like this:
A
B
Z
D
N
and what I want to do is to duplicate each line so I get this:
A
A
B
B
Z
Z
D
D
N
N
I only could think of using cat for the same file and then sort it:
cat file1 file1 | sort -k1 > file1_duplicate
but then I lose the order of my file which is important for me:
A
A
B
B
D
D
N
N
Z
Z
any suggestion would be helpful.
Try e.g.
sed p file >newfile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With