linux - awk system syntax throwing error -
I am trying to transfer all of my files to a new directory in my directory in my phone and the same Phone X.Tech in time. E.g.
1.txt, 2.txt, jim.txt
Become:
in phone1.txt directory phone1 Phone2.txt directory phone2 phone3.txt in directory3 in phone3
I am a newbie for awk, but I am successful in creating the directory, but I can not get the right to change the name . I have tried:
ls | Xargs -n1 | Awk '{i ++; System ("MKDIR Phone" i); The system ("mv" $ 0 "phone" i ".txt -t phone" I)} '
many of which are errors:
Mv: stat can not "call" i ': no such file or directory
and:
ls | Xargs -n1 | Awk 'i ++; System ("mkdir phone" i); System ("mv" $ 0 "phone" i "/phone"i".txt")} '
Error:
awk: 1: Unexpected character 0xe2
xargs: / bin / echo: ends by signal 13 Can someone help me eliminate it? TIA!
If you want to increase it by increasing the number.
Otherwise Tom Fench's way is go!
i in * .txt; Do d = phone $ ((++ x)); Mkdir "$ d"; MV "$ i" "$ d / $ d.txt"; Done
In addition to this, you can set x to x = 0
before setting it to zero if it is already set as something else
Comments
Post a Comment