New answers tagged

0

You need to escape the backslashes. At least, it did work for me: sed -e 's/^/mkdir -p \/VOLUME1\/TEST2\//' log.txt > log2.txt The beginning of the result: mkdir -p /VOLUME1/TEST2/confEclipse/MIT-Eclipse-CheckStyle-20160408.xml mkdir -p /VOLUME1/TEST2/confEclipse/MIT-Eclipse-CodeStyle-CleanUp-20160408.xml mkdir -p /VOLUME1/TEST2/confEclipse/MIT-...


1

Since you are going to grep the file content, -l listing the zip file won't be enough. you need to actually unzip it. so: temp=`mktemp -d` find . -iname '*.zip' -print -exec unzip -d $temp {} \; 2> error.txt grep -ir vbs $temp


0

You must do this by checking the file type signatures. It can be found here, or you can find it by trial and error checking your files. For example, JPG signature is FF D8 FF E0, which means it's first four bytes must be equal to FF D8 FF E0. All you need is a tool to match these bytes with those of the file. As an example, hexdump -n 4 -C file.jpg| awk '{...


1

Never use this: for f in $(find . -name \*.scala); do echo $f; gsed -i $f -e "s/\x0D$//"; done This works until you have a file whose name has whitespace or other shell-active characters. For one, the shell will perform both word splitting and pathname expansion on the output of $(find . -name \*.scala). Even without that, the shell will perform word ...


1

You might just want to run all of those through dos2unix before running sed. How to get dos2unix you might ask? Well, this is the main reason to add another answer here (and because I don't have enough rep to add comments yet). If you want to survive OSX, you need the Homebrew package manager. First thing after installing Homebrew (2 minutes) is to ...


0

I found the reason: the files had ^M (DOS style CRLF) in them - so first I had to do: for f in $(find . -name \*.scala); do echo $f; gsed -i $f -e "s/\x0D$//"; done Then subsequently the command shown in the OP works fine.


0

findstr extends the functionality of find with several useful features. Some of the key additions include findstr supports multiple search strings findstr can take as input a file containing file names or directories to search findstr supports regular expression Neither function is suitable for large files or large numbers of files.


0

It may be not vital, but you should be aware that two zips may be different even if their sizes in bytes are equal. If you wish to get rid of the danger this holds, you can check the md5sum of the files. It is still not a 100% guarantee to delete only duplicates but your chances are far better. This is one way to do it using awk to send the filenames to ...


1

Since you already have the command which files to keep, you can combine this with the move command mv. Just move them to another folder (ore give them another prefix), delete the remaining files and move them back. Take a look at the -t parameter of mv. You can use this to specify the destination and then pipe multiple files to mv.



Top 50 recent answers are included