Last active
December 9, 2020 17:38
-
-
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
This file contains hidden or 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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
be carefullll!