11/20/2013

ftp multiple files without prompt

$mput *.txt
transfer multiple files from local to remote machines

$mget *.txt
transfer multiple files from remote to local machines

Every time you will be ask to confirm the transfer, kind of annoying, to disable that, use prompt to toggle it off

ftp> prompt
Interactive mode off

11/12/2013

Zgrep/ Grep -a

 -a, --text
              Process a binary file as if it were text; this is equivalent to the --binary-files=text option.

$ zgrep -a cdp test.tl.gz

If this "-a" option is not specified, an error will come out

$ zgrep cdp tst.tl.gz

Binary file (standard input) matches

11/11/2013

Linux list with line number

$ nl tst.txt

$cat -n tst.txt


$less -N tst.txt

10/29/2013

Echo new line not working

In csh, when echo "\n" is not working, use printf "\n"

10/21/2013

Ftp show local directores

ftp> !ls
list your local files
ftp> ls
list your remote files
ftp> pwd
your remote  path
ftp> !pwd
your local  path

10/16/2013

Test blog firefox

firefox is OK to edit the posts

10/15/2013

Delete first few lines in Linux

$ cat t.txt
12
34
56
78
90
$ sed -e '1,3d' < t.txt
78
90
$ tail -n +4 t.txt
78
90
$ awk 'NR > 3 { print }' < t.txt
78
90

Known Issues for Blogger: We're investigating reports of some users not bein...

Known Issues for Blogger: We're investigating reports of some users not bein...: We're investigating reports of some users not being able to publish to their blog after correctly solving a CAPTCHA. Thanks for your pa...

5/17/2013

Linux rename multiple files

rename .htm .html *.htm


rename  will rename the specified files by replacing the first occurrence
of from in their name by to.


from rename man page

4/26/2013

Linux skip every number of lines

awk  'NR % 5 == 1'  test.txt

print one line from every 5 lines

Linux commands uniq

removes duplicate lines

3/07/2013

Linux merging two files line by line


file1
1
2
3

file2
a
b
c


$ paste file1.list file2.list > file3.list



file3
1 a
2 b
3 c

2/20/2013

GNU plot conditional plotting


($1 <=3  ? $2 : 1/0)
It means “if the current number in the first column ($1) is less than 3, use the second column ($2), otherwise draw nothing”.


plot the first two columns only when the third one equals zero. Then you can try this:
plot '1.dat' using 1:($3==0?$2:1/0)

2/19/2013

GNU plot lengend(key) too wide

In GNU plot, some times the legend is too wide, leave a lot unused space herizontally.

set key width -5

or something like that.

2/12/2013

Perl my function

In Perl,
my function define a local variable.

my $A = "what ever"

2/07/2013

lowcut

Low frequency cut

1/25/2013

Print substring

awk is a very good commands.
It can extract substring out of a string.

****$ grep 'abc' *.list  | awk '{print substr($1,14,3)}' > test1.list

print the first collumn and print the 14th, 15th, 16th charactor into a file.