Plz Help-how to avoid blank next line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Plz Help-how to avoid blank next line
# 1  
Old 02-26-2011
Plz Help-how to avoid blank next line

Hi,
I want to pick the latest file name and save it in a file. later i'll be insert this file name in a oracle table.But i m getting a strange issue. while putting the file name to a file, some extra blank line also coming to that file.i m using cmd....
Code:
ls -t *_xxx_*.dat head - 1 > yyy.csv

In yyy.csv file , i m getting the latest file name as well as blank next line.
Can anybody plz help me to remove/avoid this line?

Thanks in Advance

Last edited by Franklin52; 02-26-2011 at 05:13 PM.. Reason: Please use code tags, thank you
# 2  
Old 02-26-2011
That code couldn't possibly work. There's not even a pipe in it anywhere, and the arguments to 'head' are wrong. Please post what you actually did, copy-paste if necessary.
# 3  
Old 02-26-2011
ls -t *_xxx_*.dat | head -1 >yyy.csv
# 4  
Old 02-26-2011
After posting the actual script, please post the output from this enquiry which is designed to make line terminators visible.
Code:
sed -n l yyy.csv

# 5  
Old 02-27-2011
that's not possible.
show us.

is windows involved anywhere in the line?
# 6  
Old 02-27-2011
Code:
grep -v "^$"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

In a file, replace blank line by the last line not blank above

Dear All, In a CSV file, say that a given column has been extracted. In that column, information is missing (i.e. blank lines appear). I would like to replace the blank lines by the last valid line (not blank) previously read. For example, consider the extract below: 123 234 543 111... (7 Replies)
Discussion started by: bagvian
7 Replies

2. Shell Programming and Scripting

Avoid single line output from function

I am new to shell scripting and wished to get few things clarified. While calling functions within shell script, output comes out as single line irrespective of the no of echos or newlines I tried within function + the echo -e used to invoke function ( as instructed online) : #!/bin/sh inc() {... (1 Reply)
Discussion started by: RMath
1 Replies

3. Shell Programming and Scripting

sed - How to insert line before the first blank line following a token

Hello. I have a config file (/etc/my_config_file) which may content : # # port for HTTP (descriptions, SOAP, media transfer) traffic port=8200 # network interfaces to serve, comma delimited network_interface=eth0 # set this to the directory you want scanned. # * if have multiple... (6 Replies)
Discussion started by: jcdole
6 Replies

4. Shell Programming and Scripting

String search and print next all lines in one line until blank line

Dear all I want to search special string in file and then print next all line in one line until blank lines come. Help me plz for same. My input file and desire op file is as under. i/p file: A1/EXT "BSCABD1_21233G1" 757 130823 1157 RADIO X-CEIVER ADMINISTRATION BTS EXTERNAL FAULT ... (7 Replies)
Discussion started by: jaydeep_sadaria
7 Replies

5. Shell Programming and Scripting

How to avoid new line

Hi, I am having multiple echo statements to print output echo "$VAr" echo "$lenght" echo "$sum" I get the output as 12 24 36 I need the output to be 12 24 36. How do i arrive at this. Thanks in advance (4 Replies)
Discussion started by: krashraj
4 Replies

6. Shell Programming and Scripting

Fill the empty line by adding line before blank line

FIle A "A" 2 aa 34 3 ac 5 cd "B" 3 hu 67 4 fg 5 gy output shud be A"" 2 aa 34 "A" 3 ac 34 "A" 5 cd 34 "B" 3 hu 67 "B" 4 fg 67 "B" 5 gy 67 (6 Replies)
Discussion started by: cdfd123
6 Replies

7. Shell Programming and Scripting

Need to avoid empty line error

Hi, Below shell script executes based on liasted data files parameters.But small problem need to avoid ,If any empty line occures in dat files it's throwing oracle error .Need to ignore empty lines (means does not ready by script).Please advice. #/bin/sh adsts=`cat... (2 Replies)
Discussion started by: krajasekhar.v
2 Replies

8. Shell Programming and Scripting

Replace two blank line with a single blank line

Hi Guys, I have a file in which each set of records are separated by two blank line. I want to replace it with a single blank line. Can you guys help me out? Regards, Magesh (9 Replies)
Discussion started by: mac4rfree
9 Replies

9. Shell Programming and Scripting

how to avoid new line characters

Hi, I am using gzip command to compress the files at the UNIX server and FTP ing it in Binary mode to Windows server.(If ASCII mode is used im getting the output as junk characters) When i extract the files at Windows server a new line character is getting appended to the output file which is not... (4 Replies)
Discussion started by: Codesearcher
4 Replies

10. Shell Programming and Scripting

sed: delete regex line and next line if blank

Hi, I want to write a sed script which from batiato: batiato/giubbe: pip_b.2.txt pip_b.3.txt pip_b.3mmm.txt bennato: bennato/peterpan: 123.txt consoli: pip_a.12.txt daniele: (2 Replies)
Discussion started by: one71
2 Replies
Login or Register to Ask a Question