output one file per line

awk 'BEGIN{ORS=""}NR!=1&&FNR==1{print "\n"}{print}END{print "\n"}' *.txt
Problem: you want to output one line per file. you can't just 'tr -d' because you want one line per file and you don't want to use a loop. Solution: use awk to print each line without the record separator and a newline after each file.
Sample Output
$ cat a.txt
$ cat b.txt
$ awk 'BEGIN{ORS=""}NR!=1&&FNR==1{print "\n"}{print}END{print "\n"}' a.txt b.txt

2010-05-24 19:22:35

What Others Think

I want to output one file per line without using the loop cbd products but I have tried many methods I know but wasn't successful. I hope the one you have shared here is helpful so I thought of trying it out using the code you have shared here
Juvanta · 57 weeks and 3 days ago
Compared to programming language, these kinds of commands are really simple and we don't need to Plant-Based Dishes write complex programming codes for that. You must learn these command language and there are so many websites like this that teach you the language so easily.
Alyssalauren · 42 weeks ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: