Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How i'll delete a particular line from the file? Please give
answer as soon as possible. Thanks in advance.

Answers were Sorted based on User's Feedback



How i'll delete a particular line from the file? Please give answer as soon as possible. Thank..

Answer / jeetu

dd command.

pressing dd on the line which we want to delete.

Is This Answer Correct ?    35 Yes 4 No

How i'll delete a particular line from the file? Please give answer as soon as possible. Thank..

Answer / dhanooj

1)open file ,point to that perticular line, give
command "dd"
it will delete the line and save the file by pressing ":wq"
2)grep -v 'string pattern' file > newfile
it will create newfile with all lines from the file
except the lines containing "string pattern"
3)sed "pattern/d" filename >tmpfile
will delete all lines having this pattern and will write
to newfile
4)sed "3,d" filename >tmpfile
will remove the line 3 and will write to tmpfile

Is This Answer Correct ?    21 Yes 3 No

How i'll delete a particular line from the file? Please give answer as soon as possible. Thank..

Answer / yadvinder singh

First of all open the file in which u want to delete the
line by
vi filename

GO to that perticular line,
now press esc then press dd
it will delete ur whole line

then if u want to save the file
first press esc then type :wq then press enter
it will save ur file
..you can check it.

Is This Answer Correct ?    8 Yes 3 No

How i'll delete a particular line from the file? Please give answer as soon as possible. Thank..

Answer / rajasekhar.v

sed 'nd' filename
n means which line you want to delect

Is This Answer Correct ?    5 Yes 0 No

How i'll delete a particular line from the file? Please give answer as soon as possible. Thank..

Answer / sathish kumar p

sed '3d' file name

Is This Answer Correct ?    4 Yes 0 No

How i'll delete a particular line from the file? Please give answer as soon as possible. Thank..

Answer / ranjan tikoo

If I have 10 lines in the file and I want to delete line 5
and 6 then use

sed '5,6 d' temp1.txt > temp2.txt

Is This Answer Correct ?    2 Yes 1 No

How i'll delete a particular line from the file? Please give answer as soon as possible. Thank..

Answer / hari

uniq -u1 filename

Is This Answer Correct ?    0 Yes 0 No

How i'll delete a particular line from the file? Please give answer as soon as possible. Thank..

Answer / sekhar

by useing sed command we can delete a particular line foe example...
Ans: sed 'nd' < filename
...here n means no.of the line for ex we want to delete 5th line
sed '5d' < filename...by using this command we delete multiple lines also....
sed '5,8d' < filename..this will deletes 5th to 8th line...

Is This Answer Correct ?    0 Yes 0 No

How i'll delete a particular line from the file? Please give answer as soon as possible. Thank..

Answer / pk

any other alternatives!?

Is This Answer Correct ?    2 Yes 3 No

How i'll delete a particular line from the file? Please give answer as soon as possible. Thank..

Answer / ansar

Esc dd on command prompt in vi mode.

grep -v "pattern" will also remove the line if we know the
matching pattern on that line.

Is This Answer Correct ?    8 Yes 11 No

Post New Answer

More Unix Commands Interview Questions

when we installing aix os the ssh installed default?

2 Answers  


Give Command that will move a single file called "unix.txt"

7 Answers   IBM,


How do you copy a directory with many files and folders into another directory?

2 Answers  


What is unix command?

0 Answers  


boot process?

2 Answers   Atos Origin, Wipro,


Write a command that will display files in the current directory, in a colored, long format.

0 Answers  


Which command can you use to find the currently running process in unix server?

0 Answers  


When the shell is reading the command line what is the difference between text enclosed between double quotes ( ” ) and text enclosed between signal quotes ( ’ )?

3 Answers  


why unix commands can be divided into internal and external commands?

3 Answers   Informatica,


How to rename files and folders?

7 Answers   IBM, Oracle,


How to display no of records in oracle using unix command?

0 Answers  


What does #!/ Bin sh do?

0 Answers  


Categories