Sponsored Content
Top Forums Shell Programming and Scripting How to substitute a word in multiple file? Post 303005912 by natraj005 on Tuesday 24th of October 2017 01:31:19 PM
Old 10-24-2017
Quote:
Originally Posted by RudiC
Sorry: no info - no help.
I mean after executing the command the pattern is not getting changed/substituted with the new one. .. It remains the same old one...

---------- Post updated at 12:31 PM ---------- Previous update was at 12:24 PM ----------

Quote:
Originally Posted by natraj005
I mean after executing the command the pattern is not getting changed/substituted with the new one. .. It remains the same old one...
It is working if the dirctory have only one file, but in my condition I have around 40 files in the direcyiry and in that 40 files around 7 files will have my search pattern and that has to be changed with new pattern.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to substitute more than one word in a text file?

well i have this file here: <XML> <pregate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <system_c>HPREGATE</system_c> <trans_c>HSPG</trans_c> <trans_dt>20060105161333</trans_dt> <user_id_m></user_id_m> <func_c>C</func_c> </pregate> </XML> i want to... (2 Replies)
Discussion started by: forevercalz
2 Replies

2. Shell Programming and Scripting

Can a shell script pull the first word (or nth word) off each line of a text file?

Greetings. I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file. I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies

3. Shell Programming and Scripting

Can "sed" substitute word on a specific line?

Hello experts, I know line number of the word I want to replace. Can "sed" substitute word on a specific line? As well, can sed substitute words inside a specific patten. ex. <word>lalala</word> #replace anything between <word> and </word> minifish (2 Replies)
Discussion started by: minifish
2 Replies

4. Shell Programming and Scripting

AWK Multiple substitute

I want to reformat the following: ID1 ID001 0 0 2 1 GG TC GG CT GG AA AA AG ID2 ID002 0 0 2 2 GG 00 AG CC GG GG TC CC I want to replace only:... (1 Reply)
Discussion started by: genehunter
1 Replies

5. Shell Programming and Scripting

howto substitute word in vi command mode

Hi I'm trying to substitute word "January" with word "March" in my script but in certain lines only. I have couple words containing pattern that I want to substitute e.g. - log.January.1.array - log_January_1_array_1 - log.January.1.array - log_January_1_array_11 Trying to do cmd below... (9 Replies)
Discussion started by: presul
9 Replies

6. Shell Programming and Scripting

Perl: substitute multiple lines

I'd like to do this using Perl command line (sorry no awk, sed, etc.) replace the 3 middle lines in a file by one line: aaa 123 bbb 234 ccc 34567 dd 4567 ee 567 to: aaa 123 AAA ee 567 I tried this but not working: perl -pi -e "s/aaa\ 123\nbbb\ 234\nccc\ 34567/AAA/" file (2 Replies)
Discussion started by: tintin78899
2 Replies

7. Shell Programming and Scripting

removing a word in a multiple file starting at the dot extension

hi I would like to ask if someone knows a command or a script on how to rename a multiple file in the directory starting at the end of the filename or at the .extension( i would like to remove the last 11 character before the extension) for example Below is the result of my command ls inside... (5 Replies)
Discussion started by: jao_madn
5 Replies

8. Shell Programming and Scripting

Substitute one line of multiple files according to another file

I need to make ~96 configure files from a template config file which has hundreds of rows that looks like: template.config: #average insert size avg_ins=1000 ...... other information omitted Those config files are named in sequence from S01.config, S02.config, ... etc with different... (11 Replies)
Discussion started by: yifangt
11 Replies

9. Shell Programming and Scripting

In Vi "sed" substitute word on a specific line

i need to substitute word on a specific line. I was able to do it on command line like below but it is not working in vi. command line like below: sed -e '8s/table_name/schema.table_name/' file_name. in vi table_name and schema are my positional parameters that i pass into the script. ... (5 Replies)
Discussion started by: pimmit22043
5 Replies

10. Shell Programming and Scripting

To substitute multiple variable by their content in a file

Dear All, I would like to instantiate a "pattern file" substituting "variable name" by their content. Saying, we have: 1/ a "pattern file" containing different "variable name", the first character of the "variable name" is "@": $ cat TPTModl.txt DEFINE... (12 Replies)
Discussion started by: dae
12 Replies
QSEXEC(1)							  qsexec man page							 QSEXEC(1)

NAME
qsexec - parses the data received via stdin and executes the defined command on a pattern match. SYNOPSIS
qsexec -e <pattern> [-t <number>:<sec>] [-c <pattern> [<command string>]] [-p] [-u <user>] <command string> DESCRIPTION
qsexec reads log lines from stdin and searches for the defined pattern. It executes the defined command string on pattern match. OPTIONS
-e <pattern> Specifes the search pattern causing an event which shall trigger the command. -t <number>:<sec> Defines the number of pattern match within the the defined number of seconds in order to trigger the command execution. By default, every pattern match causes a command execution. -c <pattern> [<command string>] Pattern which clears the event counter. Executes optionally a command if an event command has been executed before. -p Writes data also to stdout (for piped logging). -u <name> Become another user, e.g. www-data. <command string> Defines the event command string where $0-$9 are substituted by the submatches of the regular expression. EXAMPLE
Executes the deny.sh script providing the IP address of the client causing a mod_qos(031) messages whenever the log message appears 10 times within at most one minute: ErrorLog "|qsexec -e 'mod_qos(031).*, c=([0-9.]*)' -t 10:60 '/bin/deny.sh $1'" SEE ALSO
qsfilter2(1), qsgeo(1), qsgrep(1), qslog(1), qslogger(1), qspng(1), qsrotate(1), qssign(1), qstail(1) AUTHOR
Pascal Buchbinder, http://opensource.adnovum.ch/mod_qos/ mod_qos utilities 10.8 June 2012 QSEXEC(1)
All times are GMT -4. The time now is 09:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy