Created
April 23, 2016 21:44
-
-
Save brendandawes/4bd2aad4eba1c49041c5b76270d9cb6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FIRST= | |
for FILE in *.csv | |
do | |
exec 5<"$FILE" # Open file | |
read LINE <&5 # Read first line | |
[ -z "$FIRST" ] && echo "$LINE" # Print it only from first file | |
FIRST="no" | |
cat <&5 # Print the rest directly to standard output | |
exec 5<&- # Close file | |
# Redirect stdout for this section into file.out | |
done > file.out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment