cat in shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting cat in shell
# 1  
Old 02-09-2011
cat in shell

Command "cat filename" works from cmd prompt. but cat is not found when I try to script it. can any one please correct the code.

C:\Users\src\scripts>cat "\\ser2\e$\Logs\Auth Files\Passed Auth\active.csv"
02/10/2011,Auth OK,tty1,abc
02/10/2011,Auth OK,tty2,xyz

Quote:
#!C:\Program Files (x86)\Shell\sh.exe
file="active.csv"
path="\\ser2\e$\Logs\Auth Files\Passed Auth\$file"

`cat $path`

C:\Users\src\scripts>sh auth.sh
auth.sh: command not found: cat [4]



Thanks
# 2  
Old 02-09-2011
Try:
Code:
cat "$path"

without the backquotes..
# 3  
Old 02-09-2011
Tried but does works..

Quote:
#!C:\Program Files (x86)\Shell\sh.exe
file="active.csv"
path="\\ser2\e$\Logs\Auth Files\Passed Auth\$file"

cat "$path"
Quote:
C:\Users\src\scripts>sh auth.sh
abnormal program termination
auth.sh: fork failed: no error [4]
# 4  
Old 02-09-2011
In my opinion (untested) the command needs to go into a MSDOS Batch file with a ".BAT" extension. It is not a unix Shell command, it is a MSDOS command which you were typing at a "CMD" prompt.
Quote:
cat "\\ser2\e$\Logs\Auth Files\Passed Auth\active.csv"
To handle this in Shell we would need the MSDOS share "\\ser2\e$" to be mounted as a unix filesystem on a named mountpoint.

Last edited by methyl; 02-09-2011 at 05:32 PM..
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 Dummies Questions & Answers

Cat Help needed

Hi, I am unable to use a basic script in cygwin. Please help me out. Script used : #!/bin/bash echo "Lucent MSC1" echo "===========" echo "Orig_MSCID Summary Top 10" cat k1.txt | grep -i orig_mscid | sort | uniq -c echo "Hourly Summary" cat k1.txt | grep "#" | cut -c 10-11 | uniq... (7 Replies)
Discussion started by: vanand420
7 Replies

3. Shell Programming and Scripting

Problems on cat and substring replacement, shell

Hi I'm new in the Shell world, and I've been trying the whole day to get my script to work. I'm under Ubuntu 10.04. Let me explain: I want to list all the files matching some regex in a directory, and then make some some string replacement on the name of the files, and then a cat on the... (2 Replies)
Discussion started by: albh
2 Replies

4. 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

5. Shell Programming and Scripting

Problem with IF - CAT - GREP in simple shell script

Hi all, Here is my requirement I have to search 'ORA' word in out.log file,if it is present then i need to send that file (out.log) content to some mail id.If 'ORA' word is not in that file then i need to send 'load succesful' message to some mail id. The below the shell script is not... (5 Replies)
Discussion started by: mak_boop
5 Replies

6. Shell Programming and Scripting

how to input the CAT command output in Shell

Hi guys... I am new to this scripting...so please forgive me if anything worng in my questions... here is my question.. I have file structure /home/oracle/<sid>/logs/bkup now i want to write a script which should grep the sid name from a file..and it should replace the <SID> with... (1 Reply)
Discussion started by: troubleurheart
1 Replies

7. 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

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. UNIX for Dummies Questions & Answers

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 (6 Replies)
Discussion started by: skyineyes
6 Replies
Login or Register to Ask a Question