Cat command, quick recap

Forum rules
Before you post please read how to get help
Level 3
Level 3
Posts: 179
Joined: Mon Mar 22, 2010 2:48 pm

Cat command, quick recap

Postby nathanjh13 » Tue Aug 20, 2013 6:17 pm

I'm combining hundreds of text files (phone memos in txt format) into one file. Many are only a handful of words long. I can do this easily enough with cat but there's no separator at all between the entries and it's a big mess, even using -n etc.


User avatar
Level 24
Level 24
Posts: 21382
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Cat command, quick recap

Postby xenopeek » Wed Aug 21, 2013 1:27 am

This topic has various ways to add a separator between files that you combine: ... ta-in-bash. First answers uses sed magic instead of cat. Second answer captures the cat action in a loop, and adds a separator with the echo command.

Return to “Scripts & Bash”