redirection problem

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting redirection problem
# 1  
Old 12-07-2007
redirection problem

Hello Experts,

I am facing the following problem ..

>cat my_file


initial begin
LDR(on); // Lock Detect Enable

But when I trying the same with the following command it shows me all the line in the same line.Like

>echo `cat my_file`

initial begin StartSim; LDR(on); // Lock Detect Enable

Is there any way around to print it as in my input file .. to the output file.
Thanks in advance..

Last edited by user_prady; 12-10-2007 at 02:46 AM..
# 2  
Old 12-07-2007
echo "`cat cattest`\n" wil honor the new line.
# 3  
Old 12-09-2007
Originally Posted by sysgate
echo "`cat cattest`\n" wil honor the new line.
Thanks for the reply. But I am afraid its not working in my shell.<tcsh>........
# 4  
Old 12-09-2007
What exactly are you trying to achieve with this code? Your code makes no sense.
# 5  
Old 12-10-2007
Originally Posted by fpmurphy
What exactly are you trying to achieve with this code? Your code makes no sense.
Thanks for the Reply..

I want to do some thing like this

#! /bin/sh

for temp in `find ./CSV/ -name  "*.file"` 
   fname=`basename $temp`

   echo "Line 1 " >  ./out/$fname
   echo "Line 2 " >>  ./out/$fname
   echo "Line 100"  >>  ./out/$fname
   ./ $temp  >>  ./out/$fname

But instead of echoing each line I need I put those lines to a file and calling it by cat command
like echo `cat morelines`

Thanks in advance .
If any other method to do it better most appriciated..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with file redirection in while

I've got a problem with file redirection in bash, in loop while (in my script done < bufor.txt). In every consecutive iteration there's a possibility that to the bufor.txt will be added some lines. Unfortunately, in loop, added lines are ignored (for example: bufor.txt has 5 lines, in 3rd iteration... (4 Replies)
Discussion started by: kk9
4 Replies

2. UNIX for Dummies Questions & Answers

little problem of file redirection (awk)

I almost reach my objective (Youhouuu !!!!) But I really don't understand why it doesn't work until the end... :wall: For clarity's sake I am taking a very simple example. The operations I am doing in the script (gsub and print) really don't have any importance !!! I just matter about... (10 Replies)
Discussion started by: beca123456
10 Replies

3. Shell Programming and Scripting

Problem in redirection of output

Hi All, i m facing very strange problem . like suppose i am in one directory and then i type ls it will display the content of directory then i redirect the output as sneha-pardus $ ls > test sneha-pardus $ cat test sneha-pardus $ awk ' { print $1 } ' test > test... (3 Replies)
Discussion started by: aishsimplesweet
3 Replies

4. Shell Programming and Scripting

Problem of redirection with <<! ... !)

Hi, I have to migrate Korn Shell who call Sybase command into Oracle Command. I have a problem on this example : DATNUM=$( sqlplus -S SA/SASASA@MIGGVDEV <<! SET FEEDBACK OFF; SET HEADING OFF; select sybase_utilities.datediff('DAY', '01/01/1900', '01/01/2000') from... (4 Replies)
Discussion started by: buzzy1804
4 Replies

5. Shell Programming and Scripting

BASH Problem / Question regarding redirection

Hi all, Maybe someone is able to help: Need to redirect the output of a command in realtime to a second command. Command-A executes a remote shell to another host, and outputs its results. Command-B displays a "dialog" with the outputs of Command-A. Command-A Output: Updating FileA... (2 Replies)
Discussion started by: mharald
2 Replies

6. Shell Programming and Scripting

Redirection problem

hi i want a solution for the fallowing: i am redirecting output from bash script in which we are running background commands like ./ contains ls -l & ps when we do as ./ 1> test.txt 2>&1 but test.txt not containing output as ls -l and ps. it showing ls -l, ps and... (2 Replies)
Discussion started by: indianwomen
2 Replies

7. Shell Programming and Scripting

file redirection problem

my querry is suppose i have duplicate std i/p with FD-3 --exec 0<&3 now redirected std i/p to a file ----exec 0<file1 suppose i am reading the file line by line --while read LINE cutting some fields and comparing it with a variable and if a match is found ... (0 Replies)
Discussion started by: mobydick
0 Replies

8. Shell Programming and Scripting

redirection problem

hi all, how to redirect the stdout msg in command line and file at the same time? e.g i got the script named, content as following: #!/bin/sh echo "111" when i run the script ./ > log.log, it will wirte the "111" into log.log, but how to show the "111" in command line... (2 Replies)
Discussion started by: eric_wong_ch
2 Replies

9. UNIX for Dummies Questions & Answers

Redirection Problem

I was simply trying to redirect some output in a log file but it foxed me. truss a.out > log It gave only the output of the a.out which was only a simple print "Hello" Then I tried truss a.out 2&1>a echo `truss a.out` > a All failed. What am i missing. Thanks (7 Replies)
Discussion started by: vibhor_agarwali
7 Replies

10. UNIX for Dummies Questions & Answers

facing a problem in redirection

Hi, I am doing this perl script print (@line(1..15)); the lines 1 to 15 get printed... how can i redirect this to file? thanks and regards vivek.s (4 Replies)
Discussion started by: vivekshankar
4 Replies
Login or Register to Ask a Question