cant find command that returns blank line


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers cant find command that returns blank line
# 1  
Old 11-15-2001
cant find command that returns blank line

This is my list of sed commands: can anyone tell me where im going wrong. The script works on a file called data which contains 6 student id's and there answers for 6 questions.

!/bin/sh
sed -e 's/*//g' \ #replace * with nothing
-e s/ /X/g' \ #replacing empty space with X
-e 's/960...../& \ #student No.
/g' \
-e 's/[0-9][0-9][TFX][TFX][TFX][TFX]/&\
/g \
e 's/[TFX]/ &/g' \

When it outputs the file there is an extra line with nothing on it. How do i get rid of the extra line??
e.g.
52000012
01 8
02 4
03 8
04 2
05 0
06 6

52000013
01 8
02 4
03 10

Any suggestions would be greatfully recieved.Smilie
# 2  
Old 11-15-2001
Your error appears to be here my firend.

-e 's/[0-9][0-9][TFX][TFX][TFX][TFX]/&\
/g \

Simply swap it for this and I believe it will work...

-e 's/[0-9][0-9][TFX][TFX][TFX][TFX]/\
&/g \

Pretty simple really...
But in future I suggest you dont post your university assignments on notice boards. Their assigned to you and only you! Smilie

Priar
# 3  
Old 11-15-2001
Thankyou my good friend

I do generally want to learn unix. Ive spent hours on this. I find the manual pages very hard to understand and the book unix in a nut shell doesnt feature anything about the commandSmilie

Thanks for your help anyway much appreciatedSmilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Linux find command returns nothing

Under one of my directories on server I have more than 500 files with different type and name. When I run the find command to list the files with 'ABC_DEFGH' in the begining of its name and older than 20 days, nothing is return as result. Though I know there are more than 400 files which their name... (10 Replies)
Discussion started by: Home
10 Replies

2. Shell Programming and Scripting

Find regex, place on individual lines and insert blank line before

Hello, I have a file that I want to be able to insert a new line before every instance of a regex. I can get it to do this for each line that contains the regex, but not for each instance. Contents of infile: Test this 1... Test this 2... Test this 3... Test this 4... Test this... (2 Replies)
Discussion started by: deneuve01
2 Replies

3. Shell Programming and Scripting

Need sed help: find regex and if the next next line is blank, delete both

I've got a report I need to make easier to read Using sh on HP-UX 11.12. In short, I want to search for a regular expression and when found, examine the next line to see if it's blank. If so, then delete both lines. If not blank, move on to the next regexp. Repeat. So far I've got: ... (7 Replies)
Discussion started by: Scottie1954
7 Replies

4. Shell Programming and Scripting

Blank line in command output

My script ssh's to another server and gathers information then process them. The problem is that the output of a command has an unwanted "blank lines". ... ssh user1@${server1} /usr/bin/ls -l /tmp/file1 | awk '{print $5}' > ${DATAFILE} ... $ cat ${DATAFILE} 123456789 (There's a blank... (7 Replies)
Discussion started by: pdtak
7 Replies

5. Shell Programming and Scripting

Blank as variable/output when run from command line

When I run this: PDHDURL=`/usr/bin/curl --silent http://www.phdcomics.com/comics.php | /usr/bin/grep -o http://www.phdcomics.com/comics/archive/.*.gif | head -1` echo -e "$PHDURL" It is totally blank. However, when I just run it from the terminal: /usr/bin/curl --silent... (2 Replies)
Discussion started by: killer54291
2 Replies

6. Shell Programming and Scripting

deleting blank line and row containing certain words in single sed command

Hi Is it possible to do the following in a single command /usr/xpg4/bin/sed -e '/rows selected/d' /aemu/CALLAUTO/callauto.txt > /aemu/CALLAUTO/callautonew.txt /usr/xpg4/bin/sed -e '/^$/d' /aemu/CALLAUTO/callautonew.txt > /aemu/CALLAUTO/callauto_new.txt exit (1 Reply)
Discussion started by: aemunathan
1 Replies

7. Shell Programming and Scripting

Unix help to find blank lines in a file and print numbers on that line

Hi, I would like to know how to solve one of my problems using expert unix commands. I have a file with occasional blank lines; for example; dertu frthu fghtu frtty frtgy frgtui frgtu ghrye frhutp frjuf I need to edit the file so that the file looks like this; (10 Replies)
Discussion started by: Lucky Ali
10 Replies

8. Shell Programming and Scripting

Find line before blank

Hello, I actually have two issues. First, here is the file the way it is now. someword someword:1 new-word new-word abcd someword someword:10 new-word new-word abcd thisis whatIneed:3 someword someword:5 new-word new-word abcd I need to get the line before the 2... (6 Replies)
Discussion started by: ddrew78
6 Replies

9. UNIX for Dummies Questions & Answers

find command returns files with spaces, mv won't work...

Hi guys. I am trying, to move files found with the find command... Script runs fine, until it reaches a file that contains spaces... Here is what i wrote up quickly. ROOTDIR=/apps/data SEARCH=$(find /data/HDTMPRestore/home/tmq/ -type f -print | grep Mods/Input/bck | cut -c19-) for i... (1 Reply)
Discussion started by: Stephan
1 Replies

10. Shell Programming and Scripting

first value of array returns blank

Hi, Please can you someone help me out to eliminate the problem. Here, it correctly prints the myFilenameCount but returns the first value of array myFilenamePatterns as blank. Thanks, Sudhakar i=0 get_config_values_from_mediation_cfg "FILENAME_PATTERN"|while read myFilenamePatterns do... (1 Reply)
Discussion started by: Sudhakar333
1 Replies
Login or Register to Ask a Question