Ads

Ads

Friday, December 25, 2009

Unix query---

1)To combile the content of file1 and file 2 into file3
->$cat file1 file2>file3

2)Display the content of file f1 without using 'cat' command.
->$tail +1 f1

3)To count duplicate lines form the file f1
->$uniq -d f1|wc -l
or
->$uniq -D f1|uniq -c

4)To remove duplicate lines from a file
->$sort f1|uniq
or
->$sort -u f1

5)To display characters form 5th position to 10th position, including both from file f1
->$cut -c5-10 f1

Unix query---

1)To display largest file in current directory.
->$ls -s|head -1

2)To display 5th line of file f1.
->$head -5 f1|tail -1
or
->$tail +5 f1|head -1

3)Remove a file name as x.
->$rm "x?"
or
->$rm x\?

4)Display last line of file f1.
->$tail -1 f1

5)To create a link between file1 and file2
->$cp -l file1 file2

Trackers

Technology blogs