如何将用户名附加到文件名中
How append the username into the file name
我有这个脚本,
find -iname \*.${EXT} -print0 | xargs -0 ls -l --time-style="+%b %Y" | awk '{print $NF,,,,}' OFS="\t" > ${EXT}.txt
awk -vextension="${EXT}" -vfiletype="${TYPE}" -vcompress="${COMP}" -vOFS="\t" '{print [=10=], ext, filetype, compress}' < ${EXT}.txt >> all.txt
我想更改脚本以自动将运行此脚本的用户的用户名附加到文件中,例如“Jason_all.txt”作为最终输出。
简单:
find -iname \*.${EXT} -print0 | xargs -0 ls -l --time-style="+%b %Y" | awk '{print $NF,,,,}' OFS="\t" > ${EXT}.txt
awk -vextension="${EXT}" -vfiletype="${TYPE}" -vcompress="${COMP}" -vOFS="\t" '{print [=10=], ext, filetype, compress}' < ${EXT}.txt >> "${USER}_all.txt"
最好将此代码段编辑为 not parsing ls
output
改为检查man find | less +/'printf format'
我有这个脚本,
find -iname \*.${EXT} -print0 | xargs -0 ls -l --time-style="+%b %Y" | awk '{print $NF,,,,}' OFS="\t" > ${EXT}.txt
awk -vextension="${EXT}" -vfiletype="${TYPE}" -vcompress="${COMP}" -vOFS="\t" '{print [=10=], ext, filetype, compress}' < ${EXT}.txt >> all.txt
我想更改脚本以自动将运行此脚本的用户的用户名附加到文件中,例如“Jason_all.txt”作为最终输出。
简单:
find -iname \*.${EXT} -print0 | xargs -0 ls -l --time-style="+%b %Y" | awk '{print $NF,,,,}' OFS="\t" > ${EXT}.txt
awk -vextension="${EXT}" -vfiletype="${TYPE}" -vcompress="${COMP}" -vOFS="\t" '{print [=10=], ext, filetype, compress}' < ${EXT}.txt >> "${USER}_all.txt"
最好将此代码段编辑为 not parsing ls
output
改为检查man find | less +/'printf format'