I have some zip files in directory when I need to unzip each in specific dir I used
ls | awk '{ print "unzip " $1 " -d " $1} '
unzip p21286665_121020_Linux-x86-64.zip -d p21286665_121020_Linux-x86-64.zip
unzip p21841318_121020_Linux-x86-64.zip -d p21841318_121020_Linux-x86-64.zip
unzip p22098146_121020_Linux-x86-64.zip -d p22098146_121020_Linux-x86-64.zip
But I need something like this.
unzip p21286665_121020_Linux-x86-64.zip -d p21286665
unzip p21841318_121020_Linux-x86-64.zip -d p21841318
unzip p22098146_121020_Linux-x86-64.zip -d p22098146
You could also use the -F argument to split the line on underscore and thus end up with something like this:
ls | awk -F_ '{print "unzip " $0 " -d " $1; }
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments