regarding delete command in unix


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers regarding delete command in unix
# 1  
Old 11-19-2006
regarding delete command in unix

Hai,


The command sed 's/...$//' filename is not working.i need an unix command that works in the command mode i.e in the esc mode.pease let me know the command to delete the last 3 letters in every line of a file .The 3 letters vary from line to line.

Regards
suneetha.
# 2  
Old 11-19-2006
sed 's/...$//g'
# 3  
Old 11-19-2006
1.- You could've asked in the original thread.
2.- "Esc mode"? Guess what you wanted is a command you can run inside vi? Maybe if you would've asked for the vi command? The command I gave you works just fine on the command line. I'll let you figure out the vi form of the command.
3.- The g is unnecessary. It makes the comand execute on all instances in a line. The last 3 digits of the line appear only once.
# 4  
Old 11-20-2006
Hi,

sed -e 's/...$//g' <filename> works fine. If at all you want to edit the file in vi mode then u can use Esc, :%s/...$//g, press enter, then :wq to save the file.

rgds,
jam
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find and delete files and folders which are n days older from one unix server to another unix server

Hi All, Let me know how can i find and delete files from one unix server to another unix server which are 'N' days older. Please note that I need to delete files on remote unix server.So, probably i will need to use sftp, but question is how can i identify files and folders which are 'N'... (2 Replies)
Discussion started by: sachinkl
2 Replies

2. UNIX for Dummies Questions & Answers

delete unix directory

I installed membersgear into my website and decided it was not right for me. I issued rm -r on directory membersgear and it deleted everything except the subdirectory templates_c. I have found several directories in this directory which are named like %%114. Ownership on these directories... (5 Replies)
Discussion started by: pdinardo
5 Replies

3. Shell Programming and Scripting

tr command to delete zeros

Hi, I have a input string 0000106 I need to extract the number after leading zeros ie the number 106. I used the command tr -d "0" and got the output as 16. Could any one of you please help me in using the tr command to get the output 106. Thanks in advance.... (2 Replies)
Discussion started by: dean_amrita
2 Replies

4. Shell Programming and Scripting

delete a line from file in unix

hi all i am facing some problem regarding deletion of a line from a text file the file consists of the lines of type which consists of more than 6 occurances of : character in it the line should be deleted completely and the line next to it must be shifted up Thanks in advance (6 Replies)
Discussion started by: vaibhavkorde
6 Replies

5. Shell Programming and Scripting

How to delete the submitted at command

Hi I have submitted an at command to run next week . Now i want to remove the submitted at command . I dont want the job to run . Can anyone help me , with the command to remove the submitted at command . thanks in advance ... (3 Replies)
Discussion started by: rxg
3 Replies

6. UNIX for Dummies Questions & Answers

Command in vi - Block delete

What command I should provide in Vi so block deletionis possible ? (1 Reply)
Discussion started by: videsh77
1 Replies

7. Shell Programming and Scripting

delete lines in unix

Hi Can anyone please provide me soln for below: I want to remove the word "system" from all the lines containing "#" and remove two lines below it. file1: ! system alpha#close logs login ! Result Required: ! alpha# ! (1 Reply)
Discussion started by: Aejaz
1 Replies

8. UNIX for Dummies Questions & Answers

How to delete many files in Unix

Hi, I am tryting to delete 3 lakch files using below command. rm 1000318* it is showing a message "sh: /usr/bin/rm: The parameter list is too long." please let me know how can i do this. Thanks Senthil (7 Replies)
Discussion started by: skcontact
7 Replies

9. UNIX for Dummies Questions & Answers

to delete a column in unix

Hai Please let me know the command in unix(command mode ) from a file that deletes the whole column (not 1st and last column )& replace with numbers starting from 1. Regards suneetha. (8 Replies)
Discussion started by: gaddesuneetha
8 Replies

10. Shell Programming and Scripting

Cannot delete file in unix

Hi, I upload incorrect filename into unix account. I tried a lot of way to delete this filename, but not work...any idea? -rwxrwxrwx+ 1 aaaaa userrr 698368 Jul 25 12:14 ab123 v2.12.09 with revision marks.doc Many Thanks!! (32 Replies)
Discussion started by: happyv
32 Replies
Login or Register to Ask a Question