Ada tiga file: LB01, LB02, LB03. Masing-masing berisi 10000 baris text, gimana caranya mengambil hanya 10 baris dari masing-masing file?
user@machine $ ls
LB01 LB02 LB02
user@machine $ wc -l LB01 LB02 LB03
10000 LB01
10000 LB02
10000 LB03
user@machine $ ls > list
user@machine $ for i in `cat list`; do tail "$i" > "$i".10; done
user@machine $ ls
LB01 LB02 LB02 LB01.10 LB02.10 LB02.10
user@machine $ wc -l LB01.10 LB02.10 LB03.10
10 LB01.10
10 LB02.10
10 LB03.10
LB01 LB02 LB02
user@machine $ wc -l LB01 LB02 LB03
10000 LB01
10000 LB02
10000 LB03
user@machine $ ls > list
user@machine $ for i in `cat list`; do tail "$i" > "$i".10; done
user@machine $ ls
LB01 LB02 LB02 LB01.10 LB02.10 LB02.10
user@machine $ wc -l LB01.10 LB02.10 LB03.10
10 LB01.10
10 LB02.10
10 LB03.10
halo, pls put my link on ur blog š
I have done some work on text processing as well using awk, send and bash scripting; you might be interested.
http://unstableme.blogspot.com/
Thanks.
Thanks Jadu. I’ll try it.
btw, you might be interested in Windows PowerShell as well. I’m working on windows environment so sometime i use powershell.