ls -l your/directory/ | wc -l
to count number in a directory
wc -l your_file.txt
directory size in MB
du -sh your/directory/
ls -l | awk '{printf "%s %i %s %s %.3fMB %s %i %s %s\n", $1,$2,$3,$4,$5/1024000,$6,$7,$8,$9}'
Cut (split) a single file in multiple files
perl -n -e '/^pattern/ and open FH, ">output_".$n++; print FH;' input_file
pattern is the text on the basis of which files will be spliced.
other possible methods are -
awk '/^pattern/{close("file"f);f++}{print $0 > "file"f}' input.txt
csplit -k input.txt '/^pattern/' '{99}'
Display file lines
head -15 file_name
It will show first 15 lines of file. By default 'head' will show the first 10 lines
tail -15 file_name
It will show last 15 lines of file. By default 'tail' will show the last 10 lines
No comments:
Post a Comment