Difference between cat , cat > , cat >> and touch !!!


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Difference between cat , cat > , cat >> and touch !!!
# 1  
Old 05-28-2008
Difference between cat , cat > , cat >> and touch !!!

Hi

Can anybody tell the difference between Difference between cat , cat > , cat >> and touch command in UNIX?

Thanks
# 2  
Old 05-28-2008
This looks like homework. Please do not post homework problems.
# 3  
Old 05-28-2008
Sir,
Can't understand that why these doubts look like homework to you.
Its a section for Unix Dummies and i am simply asking dummies questions.

Kindly let the users reply to the doubts.

Thanks alot

Quote:
Originally Posted by fpmurphy
This looks like homework. Please do not post homework problems.
# 4  
Old 05-28-2008
Pls do the following and understand yourself

[U16511@a462uss ~]$ ls -l file3
ls: file3: No such file or directory
[U16511@a462uss ~]$ cat file3
cat: file3: No such file or directory
[U16511@a462uss ~]$ cat > file3
hai
Ctrl C
[U16511@a462uss ~]$ cat file3
hai
[U16511@a462uss ~]$ cat >> file3
hello
Ctrl C
[U16511@a462uss ~]$ cat file3
hai
hello
[U16511@a462uss ~]$
# 5  
Old 05-28-2008
Thanks Stephen

Quote:
Originally Posted by steephen
[U16511@a462uss ~]$ ls -l file3
ls: file3: No such file or directory
[U16511@a462uss ~]$ cat file3
cat: file3: No such file or directory
[U16511@a462uss ~]$ cat > file3
hai
Ctrl C
[U16511@a462uss ~]$ cat file3
hai
[U16511@a462uss ~]$ cat >> file3
hello
Ctrl C
[U16511@a462uss ~]$ cat file3
hai
hello
[U16511@a462uss ~]$
# 6  
Old 05-28-2008
cat <file name> => displays the contents of the file
cat => takes input from STDIN and puts it back to the STDOUT
cat > <filename> => Take in put from STDIN and put contents in <filename>, This will overwrite the contents.
cat >> <filename> => Take in put from STDIN and put contents in <filename>, This will append the contents.

- Dheeraj
# 7  
Old 05-28-2008
Why does this smell like homework? Primarily because your question is of such a very basic nature that the typical newbie wouldn't even be able to associate those 4 items to form a question.

Use man cat and man touch to get your answers.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Cat with << >>

Hi, When I was analyzing the code I got below line. cat - << 'EOF' >> ${FILE PATH} I surfed net to understand but I couldn't get what is about. Please help me out. (2 Replies)
Discussion started by: stew
2 Replies

2. UNIX for Advanced & Expert Users

Help need on cat command

I have two files as below 1.txt AA 123 CC 145 DD 567 2.txt AA 111 YY 128 CC 144 FF 222 DD 777 ZZ 875 basically 1.txt is updated file, if i do cat 1.txt 2.txt output should be as below o/p (4 Replies)
Discussion started by: Tecnical_help12
4 Replies

3. UNIX for Dummies Questions & Answers

Question regarding Cat

Can we concatenate say, I have a few files prefixing with 2009... So now i want all the 2009 files into one single file.. Can this be achieved???? (4 Replies)
Discussion started by: saggiboy10
4 Replies

4. Shell Programming and Scripting

Using cat and awk.......

Im trying to use cat and awk to calculate the total space, then display it using the print command. But something in my script is not correct? cat | awk '{print$1}' | sort -n | grep -v used | awk '{sum += $1} END { p rint sum;}' ??? Any help would be greatly appreciated!! (10 Replies)
Discussion started by: bigben1220
10 Replies

5. UNIX for Dummies Questions & Answers

for cat help

Hi there, I have the following problem. I have a csv file which looks like 'AGI,ABJ,Y,Y,Y,None,EQUATION,ANY,ANY,None,' 'AGI,ABJ,Y,Y,Y,None,EQUATION HEAVY,ANY,ANY,None,' 'AGI,ABJ,Y,Y,Y,None,VARIATION,ANY,ANY,None,' but I do this for ab in $(cat test.csv); do echo $ab; done in the... (4 Replies)
Discussion started by: sickboy
4 Replies

6. Shell Programming and Scripting

cat in the command line doesn't match cat in the script

Hello, So I sorted my file as I was supposed to: sort -n -r -k 2 -k 1 file1 | uniq > file2 and when I wrote > cat file2 in the command line, I got what I was expecting, but in the script itself ... sort -n -r -k 2 -k 1 averages | uniq > temp cat file2 It wrote a whole... (21 Replies)
Discussion started by: shira
21 Replies

7. UNIX for Dummies Questions & Answers

'shutdown' and 'cat'

Hi All, This is actually a good interview question. On linux, the permissions and group for 'shutdown' and 'cat' is the same. -rwxr-xr-x 1 root root 18K 2008-05-21 10:43 shutdown -rwxr-xr-x 1 root root 17K 2007-01-30 19:51 cat Then why is it that a... (5 Replies)
Discussion started by: scottsiddharth
5 Replies

8. Shell Programming and Scripting

for i in `cat myname.txt` && for y in `cat yourname.txt`

cat myname.txt John Doe I John Doe II John Doe III ----------------------------------------------------------------------- for i in `cat myname.txt` do echo This is my name: $i >> thi.is.my.name.txt done ----------------------------------------------------------------------- cat... (1 Reply)
Discussion started by: danimad
1 Replies

9. Shell Programming and Scripting

cat and loop

Hi I have a simple code that I want to execute. out=out.txt for f in `cat list.txt | head -1`; do echo $f >> $out echo "sleep 5" >> $out done cat list.txt | head -1 wget -q -O - 'http://test.com:15100/cgi-bin/search cat out.txt wget sleep 5 -q sleep 5 -O (10 Replies)
Discussion started by: soemac
10 Replies
Login or Register to Ask a Question