Shell Program which deletes all lines ...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell Program which deletes all lines ...
# 1  
Old 07-16-2008
Shell Program which deletes all lines ...

Shell Program which deletes all lines containing the word "UNIX" in the files supplied as argument..please help me to do this task Smilie
# 2  
Old 07-16-2008
What have you tried so far?
# 3  
Old 07-16-2008
Its for my friend , I am a newbie and don't have much idea how to do this..
# 4  
Old 07-16-2008
#!/bin/sh
sed 's/UNIX//g < FILENAME
# 5  
Old 07-16-2008
cat FILENAME | sed 's/UNIX//g > OTHERFILENAME
sed 's/UNIX//g < FILENAME > OTHERFILENAME

anything will do.

- nilesh

Last edited by ynilesh; 07-16-2008 at 12:18 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. OS X (Apple)

A system deletes my .bashrc file

It deletes my .bashrc file rarely but predictability after some unknown count of Mac's restarts. Has someone ever faced such behavior? How do I prevent OS X from modifying .bashrc? What ownership/permission should I set up to not let it happen? OS X Lion. (6 Replies)
Discussion started by: scrutinizerix
6 Replies

2. UNIX for Dummies Questions & Answers

sed command that deletes lines with 3-5 digit strings

Hello! My final exam in my Linux class is tomorrow, and I was just reviewing the grep and sed commands. I came across an example, by which I got stumped: it asks to provide a sed command that deletes all lines that contain exactly 3 to 5 digit strings, from a file. In this case, I created a... (3 Replies)
Discussion started by: kalpcalp
3 Replies

3. Shell Programming and Scripting

Script that takes IP address as an Input and deletes 7 lines

I have a flat file that contains a list of IP address following 6 additional lines. I would like to get a help in the following. a shell script that would take ip address or list of ip addresses as input, search one by one the ip address in the file and as soon as it find the exact match it... (12 Replies)
Discussion started by: knijjar
12 Replies

4. Shell Programming and Scripting

Script to replace/delete lines in C program

I am under the gun on a project and am not very good at scripting. I have to make a modification to thousands of C programs to basically replace the #pragma statement. I don't want to have to do it manually. Here is an example of what I need done. Any help would be greatly appreciated. I... (5 Replies)
Discussion started by: jclanc8
5 Replies

5. Solaris

rm -rf not able deletes file but not the directory

i am trying to remove a directory using rm -rf command but its not getting removed.. it doesnt throw any error also.. i am logging as the owner of the dir and removing it but still no luck.. i am able remove a file but not a directory. i am using solaris 10 (12 Replies)
Discussion started by: chidori
12 Replies

6. Slackware

Thunderbird 3.1.9 deletes from drafts

I am using Tbird as it came with Slackware 13.37 and everytime I send something I get a message 1 or 2 drafts deleted. Should it be doing that? If not has this been reported ? How can I find out if it was reported? I have no drafts to delete. (2 Replies)
Discussion started by: slak0
2 Replies

7. Programming

To display unique lines in a Program

I am new to C programming. I have been trying to display unique lines in a file from past two days. The problem is here, I have a file whose contents are, ras.beamtele.net ras.beamtele.net ras.beamtele.net ras.beamtele.net ras.beamtele.net ras.beamtele.net ras.beamtele.net... (1 Reply)
Discussion started by: Teju88
1 Replies

8. Shell Programming and Scripting

A script that deletes files.

I want to write a script that deletes files inside the dir. However, the script should also allow the user to confirm by pressing (d) key before deleting files.. #!/bin/bash for file in $1/* do size='ls -l $file | cut -f 5 -d " "' name='ls -l $file | cut -f 9 -d " "' ... (1 Reply)
Discussion started by: herberwz
1 Replies

9. UNIX for Dummies Questions & Answers

Deletes those files in a directory ?

I need a shell script that accepts 2 directories names bar1 and bar2 as arguments , and deletes those files in bar2 which are are identical to their name spaces in bar1. I tried with this code but it gives error. if then echo " syntax <comnd dir1 dir2 > " exit else ... (6 Replies)
Discussion started by: krishnampkkm
6 Replies

10. UNIX for Dummies Questions & Answers

Multi line deletes

I would like to be able to delete the first n lines of a file from inside of a ksh script. I am not sure how to achieve this or if it is possible. Could someone please help. Thanks in advance. (5 Replies)
Discussion started by: rehoboth
5 Replies
Login or Register to Ask a Question