I noticed that if there is more that one line to change in the same file imput, It changes only one?.
example
sw1135g.sps 2657.00 7305.00 2 1
sw1135g.sps 2650.00 7307.00 2 1 sw1135g.xps 2657.00 7305.00 2 1 sw1135g.xps 2650.00 7307.00 2 1
in the output file there is only one change for
sw1135g.sps 2657.00 7305.00 2 1
but not for
sw1135g.sps 2650.00 7307.00 2 1
How I can maby files in the same file
---------- Post updated at 01:37 PM ---------- Previous update was at 01:35 PM ----------
dear ctsgnb
I noticed that if there is more that one line to change in the same file imput, It changes only one?.
example
in the output file there is only one change for
but not for
How I can change many files in the same file
---------- Post updated at 01:37 PM ---------- Previous update was at 01:37 PM ----------
dear ctsgnb
I noticed that if there is more that one line to change in the same file imput, It changes only one?.
example
in the output file there is only one change for
but not for
As is, the code does not handle this case, it needs to be adapted (only one line per file in datatochange.txt, the input file must be different from eatchother)
If you want only one output, just modify the name of the target file so that it doesn't vary with the name of the input file which is very simple to do :
Thanks not to use uppercase, this is kind of annoying.
You could give a try to this quick solution:
1) run the code above
2) then run the generated script "change2run"
This should generate *.new files with all the substitutions done in it.
and "datatochange.txt" can have multiple line with a same filenames, this code should be able to handle it properly
Thansk a lot for four help,, and soory for the uppercase letters,, I didn't notice that..
Regards
---------- Post updated at 06:45 AM ---------- Previous update was at 01:52 AM ----------
Dear ctsgnb
the code is working perfect, as you say I got all the substitutions in the file .new..
But please can you advise me why , when I run the script change2run
give me this msg.
> change2run
The code is as following
and I notice that in the file datatochange.txt..
there is many new enters
Hi All,
I am having below sample data in a file.
I need to find all the line form this file with word ABC and i need to replace the characters at position 120 which is "CO:BOGFDUI"(30chars) in the lines with blank space.
I have tried using grep to find the word with ABC (grep ABC filename),... (3 Replies)
Hi,
I am new to shell scripting. I have a config file where key and value is stored as below. In my shell script, I want to look for Test ID in the config file and replace the value 1 with another value stored in a variable. How would I do that ?
<Config Key="Test ID" Value="1"/>
I... (6 Replies)
Hello Forum.
I have a file called abc.sed with the following commands;
s/1/one/g
s/2/two/g
...
I also have a second file called abc.dat and would like to substitute all occurrences of "1 with one", "2 with two", etc and create a new file called abc_new.dat
sed -f abc.sed abc.dat >... (10 Replies)
Hi All,
I have a XML file which is looks like as below. <<please see the attachment >>
<?xml version="1.0" encoding="UTF-8"?>
<esites>
<esite>
<name>XXX.com</name>
<storeId>10001</storeId>
<module>
... (4 Replies)
Legends,
I have a file /tmp/list.txt
I want to find "/bin/" and replace it with "/log/"
I tried the follwoing but no luck
Sandy: /tmp> perl -pi -e 's/\/bin\/\/log\/' /tmp/list.txt >> /tmp/try
Substitution pattern not terminated at -e line 1.
AND,
Sandy: /tmp> perl -pi -e... (2 Replies)
I've never written scripts (just switched from Ada to C++). I have a book that's over my head and a few examples, other then that I'm floundering. Everything here at work is being done in C Shell. None of the C++ programmers are experienced in shell scripting.
I have a data file with the... (2 Replies)
Is there a way to do a find and replace in a .gz file in a single script ?
I can always unzip, find and replace and then zip it again but would hate to do this everytime.
Thanks !
Vivek (1 Reply)
Hi everyone,
I am new to the world of shell script programming.
I have a file named Fnd1.txt which has the contents as below.
I need to replace the \t with the tab space. Can any one help me
to write a perl scipt for this.
USA45V1\tG\t341029
USAV1T1\tG\t450545
USAREJ1\tG\t572645... (5 Replies)
I build several files by using the cut command to grab select fields(columns) from a really bid csv file. Each file is one column of data. I then put them together using paste command. Here is the code built in tcsh:
cut -d , -f 1 some.csv > 1.csv
cut -d , -f 10 some.csv > 10.csv
paste 1.csv... (2 Replies)