Reputation: 21048
Using gawk for Windows included in GnuWin32, how do you append the filename to a text file?.
This is an example of what I want:
Filename -> text.txt
"aaaa","bbbb","c"
The result should be:
"aaaa","bbbb","c","text.txt"
Upvotes: 1
Views: 1225
Reputation: 36262
It exists (at least in Linux version) a variable FILENAME
with the name of the file in process. So use it:
awk '
BEGIN {
FS = OFS = ",";
}
{
print $0 OFS "\"" FILENAME "\""
}
' input-file
Upvotes: 5