Skip to content

Instantly share code, notes, and snippets.

View thefiend's full-sized avatar
Brewing some coffee

Jason Kam thefiend

Brewing some coffee
View GitHub Profile
@thefiend
thefiend / print_first_line
Last active September 29, 2018 08:34
Bash script to copy first line from all the text files in the current folder and save it as results.txt
#!/usr/bin/env bash
#
# Bash script to copy first line from all the text files
# in the current folder and save it as results.txt
#
rm results.txt; ls *.txt | xargs -I {} head -1 {} >> results.txt
echo "===== Results =====";
cat results.txt