Hi,

On Friday 06 September 2013 10:46 PM, Shrinivasan T wrote:
> For a tamil wiktionary [ http://ta.wiktionary.org] project, we need to
> delete multiple patterns from a text file.
>
> currently, we are using gedit and using find/replace with space for the
> each pattern.
>
> See the task here.
> http://www.youtube.com/watch?v=rF2KLhxFq9w
>
> Is there any gedit plugin to "find and replace multiple strings" or any
> command line tool to do this?
>
> Hope we can do with some regular expression and sed/awk utilities.
>
> Can anyone try them and share the snippet?
>

There are plenty of options. Unix tools excel at this sort of thing. Some 
options:

1. Open the file in vim and then type:

:%s/<search pattern>/<replace pattern>/g

2. Run the command:

perl -pi -e 's/<search pattern>/<replace pattern>/g'

3. Run the command:

sed -i -e 's/<search pattern>/<replace pattern>/g'

You might notice that, all these approaches follow almost the same syntax, 
that's because it is a almost standard regular expression search-and-replace 
syntax. This form of seach-and-replace is *very* flexible, allowing you to 
search for multiple strings and replacing them or for allowing the replacement 
string to contain part of the matched searched string ...etc. If you could 
provide a more concrete example of search and replacement strings, we could 
possibly help you better (although, since I do not know tamil, that might 
possibly limit the extent to which I could help).

cheers,
- steve
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
ILUGC Mailing List Guidelines:
http://ilugc.in/mailinglist-guidelines

Reply via email to