Skip to content

Instantly share code, notes, and snippets.

@MADscientist314
Last active December 9, 2020 17:38
Show Gist options
  • Save MADscientist314/b23fb73c2dfec4838fdaae5b89c22181 to your computer and use it in GitHub Desktop.
Save MADscientist314/b23fb73c2dfec4838fdaae5b89c22181 to your computer and use it in GitHub Desktop.
append the filename to the first column of every file in a directory
for i in *;
do
#practice (wont overwrite the file
nawk '{print FILENAME"\t"$0}' $i > $i.bk; mv $i.k $i;
#will overwrite the file
#nawk '{print FILENAME"\t"$0}' $i > $i.bk; mv $i.bk $i;
done
@MADscientist314
Copy link
Author

be carefullll!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment