Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试将带有文件名的列添加到每行的末尾。每一行都有一个
Name Surname some_number
Name和surname用空格number隔开,Surname用制表符隔开。
Name
surname
number
Surname
我正在使用此脚本执行此操作,但它不起作用,它仅将文件名添加到行首。
$1=temp nawk -v F'\t' -v OFS='\t' '{$2=$2" "$temp} 1' $temp
PS操作系统是SunOS。
尝试:
awk '{ printf( "%s %s\n", $0, FILENAME ); }' infile
awk '{print $0, FILENAME}' 文件