Tag Archives: file

fcrackzip

NAME
fcrackzip – a Free/Fast Zip Password Cracker
SYNOPSIS
fcrackzip [-bDBchVvplum2] [--brute-force] [--dictionary] [--benchmark] [--charset characterset] [--help] [--validate] [--verbose] [--init-password string/path] [--length min-max] [--use-unzip] [--method name] [--modulo r/m] file...
EXAMPLE
fcrackzip -v -b -p aaaaaaa -u file.zip
fcrackzip -b -u -l 1-7 file.zip

rename

NAME
rename – renames multiple files
SYNOPSIS
rename [ -v ] [ -n ] [ -f ] perlexpr [ files ]
EXAMPLE
rename 's/\.JPG/\.jpg/' *.JPG
rename 's/ //' *.JPG
rename 'y/A-Z/a-z/' *

How to add line number

Simple but useful. The sample file is “,” delimited.
$ cat sample
3232,32332,54545,34
3233,45645,23233,23
1211,1212,4343,434
3434,121121,121,33

If I have to add the line number as the first field. Then
$ awk '{$1=$1; print NR,$0}' sample
1|3232|32332|54545|34
2|3233|45645|23233|23
3|1211|1212|4343|434
4|3434|121121|121|33

If I have to change the field separator of the above file from “,” to “|” (can also be done using ‘tr’) and have to add the line number as the first field. Then
$ awk 'BEGIN{FS=",";OFS="|"} {$1=$1; print NR,$0}' sample
1|3232|32332|54545|34
2|3233|45645|23233|23
3|1211|1212|4343|434
4|3434|121121|121|33

How to replace text in single or multiple files

sed commands change from distribution to distribution. The proposed method should be working for each distribution.
for i in *.file; do sed -i _modified 's/foo/bar/g' "$i"; mv "$i"_modified "$i"; done

If you want add filename into file, you could join another sed command. Our files have code_BLABLA.foo format:
for i in *.foo; do m="$( echo $i | sed 's/_[A-Z_]*.foo//g' )"; sed -i _ 's/#/code='$m'/g' "$i"; done

If you need add also “-” into code because it has ABC12345 format and you want ABC-12345 format:
for i in *.foo; do j="$( echo $i | sed 's/_[A-Z_]*.foo//g' )"; k="$( echo $j | sed 's/\([A-Z]*\)/\1-/' )"; sed -i _ 's/#/code='$k'/g' "$i"; done

bzip2, bunzip2

NAME
bzip2, bunzip2 – a block-sorting file compressor, v1.0.4 bzcat – decompresses files to stdout bzip2recover – recovers data from damaged bzip2 files
SYNOPSYS
bzip2 [ -cdfkqstvzVL123456789 ] [ filenames ... ]
bunzip2 [ -fkvsVL ] [ filenames ... ]
bzcat [ -s ] [ filenames ... ]
bzip2recover filename

find

NAME
find – search for files in a directory hierarchy
SYNOPSYS
find [-H] [-L] [-P] [-D debugopts] [-Olevel] [path...] [expression]
EXAMPLE
find . -name yourfilename