I have a large directory with files like this:
file1.txt file1.meta file1.csv file2.txt file2.meta file2.csv file2.abc and I would like to create zip files like:
file1.zip file2.zip I have tried
ls -1 ~/TEMP | sed 's/\.[a-z]*//g' | uniq | awk '{print $NF}' | xargs -i zip {}.zip ~/TEMP/{}.* But that just gives an error message that the file cannot be fund. The problem is with the wildcard * I guess.
zip error: Nothing to do! (file1.zip) zip warning: name not matched: /home/user/TEMP/file.*
sed 's/\.[a-z]*//g' | uniq.zip file1.zip file1.*&zip file2.zip file2.*lsof the current working directory and an argument to zip of the~/TEMPdirectory.H=${Q%%.*}is neat.