You can do:
for f in *.txt; do (cat "${f}"; echo) >> finalfile.txt; done
Make sure the file finalfile.txt
does not exist before you run the above command.
If you are allowed to use awk
you can do:
awk 'FNR==1{print ""}1' *.txt > finalfile.txt
More Related Contents:
- Linux grep command with relevant values as output
- How to permanently set $PATH on Linux/Unix [closed]
- How to pass command output as multiple arguments to another command
- Get exit code of a background process
- Is there a way to change the environment variables of another process in Unix?
- Aborting a shell script if any command returns a non-zero value
- How to merge two files using AWK? [duplicate]
- Split one file into multiple files based on delimiter
- What is the difference between using `sh` and `source`?
- Setting environment variables in Linux using Bash
- Sorting a tab delimited file
- What does `set -x` do?
- Does “argument list too long” restriction apply to shell builtins?
- Given two directory trees, how can I find out which files differ by content? [closed]
- How do I syntax check a Bash script without running it?
- How does SIGINT relate to the other termination signals such as SIGTERM, SIGQUIT and SIGKILL?
- Fast Concatenation of Multiple GZip Files
- Linux/Unix man page syntax conventions
- Is the UNIX `time` command accurate enough for benchmarks? [closed]
- Uppercasing First Letter of Words Using SED
- Why can’t I use Unix Nohup with Bash For-loop?
- Is gettimeofday() guaranteed to be of microsecond resolution?
- How to compare two DateTime strings and return difference in hours? (bash shell)
- Linux/Unix command to determine if process is running?
- How do I get cURL to not show the progress bar?
- grep without showing path/file:line
- Using `date` command to get previous, current and next month
- Joining multiple fields in text files on Unix
- How can I use xargs to copy files that have spaces and quotes in their names?
- Find all files with name containing string [closed]