KioskeaKioskeaCommentCaMarcheSign up, it's free !
Friday July 4, 2008 - 11:00:49 am BST
Command to find files and update
par prasana77
 Threaded discussions
Statut : Not resolved
Tuesday April 8, 2008 11:47:30 AM
Hello,

I'm a new-be in Linux
I want to be able to update/overwrite all files named
'test.txt' in a directory ( and its subdirectory ) with a particular text, say 'information'.
The files named test must be searched recursively within the directory as they may be present in any of the sub-directories.

Would be glad if anyone tell me a command for this.

Thanks and Regards.
Configuration: Windows XP
Internet Explorer 6.0
Reply to prasana77  Report this message to moderators Go to last message

1


  • This message seems useful, vote!
  • Report this message to moderators
By scrshots, on Tuesday April 8, 2008 03:29:57 PM Threaded discussions
Hello

There is not one command. you would need to use various commands either in a script ( batch file ) or on a single line taht takes the output from one function to the input of the next.

There are many ways to do it. They all would involve some form of what you asked it to do.

Search files by name, recursive. (some people put files listed in a new file to use as second part of input) Take those files and search for text string. Replace string with new string.

see the man pages on functions and put together a plan. I think you can do it.
Reply to scrshots

2


  • This message seems useful, vote!
  • Report this message to moderators
By jipicy, on Sunday April 13, 2008 07:57:41 AM Threaded discussions
Hi,

Try something like this :
find /directory -name "test.txt' -exec sed 's/information/new_information/' {} \;
;-))
JP - Eleveur de pingouins -
Faites un geste pour l'environnement, fermez vos fenetres et adoptez un manchot.
Reply to jipicy

3


  • This message seems useful, vote!
  • Report this message to moderators
By dave, on Wednesday June 11, 2008 07:28:22 AM Threaded discussions 
.


Command line search in linux, Find any file quickly.

article:

http://www.codetechnical.com/linux/search-for-a-file-in-linux.html


.
Reply to dave
Currently no message on this subject
Reply
Message title :
Your nick:
Your E-mail :
Message: 
  •  
  •  
Options: Get the answers by mail.
 

Help