Command to delete a word in all files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Command to delete a word in all files
# 1  
Old 04-02-2015
Command to delete a word in all files

can anyone tell me what is the commands to delete the below particular word [/ftp/] in the all files located in one particular file path


Code:
 
files/ll>grep "/ftp/" test.kell
   ftp -m uskmc -d /ftp/ -i  filename.zip

output should be :

Code:
 
 ftp -m uskmc -d -i  filename.zip


Last edited by ramkumar15; 04-02-2015 at 07:58 AM..
# 2  
Old 04-02-2015
Please show what you have tried.
# 3  
Old 04-02-2015
Code:
sed 's/\ftp\//g' filename.txt >filename1.txt

# 4  
Old 04-02-2015
The mistake is eye catching. Compare your code with the request.

Please explain your code character by character.
# 5  
Old 04-02-2015
HINT: replace the sed delimiter (/) with # and you will catch your mistake Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to bypass rm command when there are no files to delete?

Hi, Below command works fine when we have other files apart from hello.txtls | ggrep -v hello* | xargs rm -rfBut, if there is only one file i.e hello.txt the rm command does not find anything to delete and the script hangs. While there could be trivial ways to check using if conditions if... (6 Replies)
Discussion started by: mohtashims
6 Replies

2. Shell Programming and Scripting

Please - Looking for a online command to delete files

I have list of files like below, I want to delete files older than 2 days except S0000000.LOG, I have command find /export/home/X_GZPQJK/out/file* -mtime +1 -exec rm {} \; but it is deleting S0000000.LOG, Can you please help me how to modify command to delete except S0000000.LOG. $ ls -ltr... (2 Replies)
Discussion started by: prince1987
2 Replies

3. Shell Programming and Scripting

Delete all files if another files in the same directory has a matching occurrence of a specific word

he following are the files available in my directory RSK_123_20141113_031500.txt RSK_123_20141113_081500.txt RSK_126_20141113_041500.txt RSK_126_20141113_081800.txt RSK_128_20141113_091600.txt Here, "RSK" is file prefix and 123 is a code name and rest is just timestamp of the file when its... (7 Replies)
Discussion started by: kridhick
7 Replies

4. Shell Programming and Scripting

Find command to delete the files

Hi All, I've created 2 files touch -t 201309101234 aa10 touch -t 201309111234 aa11 Exact 60 days before from today date is SEPT 12th . As per the following command as i gave +60 means the files which were created before sept12th should be deleted find /etc/logs/*aa* -type f -atime +60... (5 Replies)
Discussion started by: smile689
5 Replies

5. UNIX for Dummies Questions & Answers

Find command to delete old files

Hi, I want to delete all the log files that was created on year 2008. My command is not working. Any idea? find . -name '*.log' -mtime 1460 -exec ls -lt {} \; Thank you. (2 Replies)
Discussion started by: samnyc
2 Replies

6. Shell Programming and Scripting

How to delete last occurence of word using Linux command?

Hi all, I am trying to delete last occurrence of word using sed command. for example. I have input like this on a.id1 = b.id1 and on a.id2 = b.id2 and on a.id3 = b.id3 and and I am expecting output like this on a.id1 = b.id1 and on a.id2 = b.id2 and on a.id3 = b.id3 I just need to... (11 Replies)
Discussion started by: nsk
11 Replies

7. UNIX for Dummies Questions & Answers

Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word

I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL. I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies

8. Shell Programming and Scripting

Search the word to be deleted and delete lines above this word starting from P1 to P3

Hi, I have to search a word in a text file and then I have to delete lines above from the word searched . For eg suppose the file is like this: Records P1 10,23423432 ,77:1 ,234:2 P2 10,9089004 ,77:1 ,234:2 ,87:123 ,9898:2 P3 456456 P1 :123,456456546 P2 abc:324234 (2 Replies)
Discussion started by: vsachan
2 Replies

9. Shell Programming and Scripting

Delete all files if another files in the same directory has a matching occurence of a specific word

Hello, I have several files in a specific directory. A specific string in one file can occur in another files. If this string is in other files. Then all the files in which this string occured should be deleted and only 1 file should remain with the string. Example. file1 ShortName "Blue... (2 Replies)
Discussion started by: premier_de
2 Replies
Login or Register to Ask a Question