Hi Makarand,
Why use:
instead of:
The second form will not fail due to ARG_MAX limits nor filenames containing whitespace characters; doesn't need to start up a subshell, doesn't need to invoke ls or awk; and will run faster.
All expansions of $file and $filedata also need to be quoted.
It also seems strange that this code replaces everything in every input file with one copy of the text that was supposed to be added after every occurrence of the word <html> in the corresponding input file instead of adding that text to the existing file in the specified spot(s).
Hi Ferocci,
Is the text to be added contained in a file, or is it just a string in your script?
I don't have time to give a complete proposal tonight, but if I was doing this I'd probably use ed -s "$file" in a loop instead of reading the files line by line in the shell (and I certainly wouldn't use echo to copy the results back to the files being processed.
Do you need more help with this?
This User Gave Thanks to Don Cragun For This Post:
Hello friends,
I have hundreds files in hand, which need extract some data from logs and read these data into an input file.
Here I will explain in detail using these two files as attached. read some data from .log file and write it into the .in file.
**explanation is given inside two... (9 Replies)
I have a script which converts a .csv file to html nicely. Trying to add 3 colors, green, yellow and red to the output depending upon the values in the cells. Tried some printf command but just can't seem to get any where. Any ideas would be appreciated. nawk 'BEGIN{
FS=","
print ... (7 Replies)
Hi, What will be the best way to connect (ssh) to hundreds of nodes and grep log files parallely from shell. Using for loop seems to be sequential. Are there any shell built in construct which could be used to achieve this? Is the sub shell any good here? (1 Reply)
Hi,
I am having issues trying to figure out how to rename files like this:
TEST1_B.tt
To
SQP_CAN_B.tt
I have hundreds of files like those, I need to rename them automatically.
Any help will be greatly appreciated.
Thanks, (5 Replies)
Hello,
I have one file which has been inserted intermittently with HTML web page.
I would like to remove all text between "<html xmlns="http://www.w3.org/1999/xhtml">" and </html> tags.
Can any one please suggest me sed regular expression for it.
Thanks (3 Replies)
i know how to add two numbers using expr,
but if i have a file with hundreds of numbers, how do i add them all together, without typing them all one by one?
for example, file.txt contains
4
5
6
7
how can i give a command to add them, without typing
$ expr `4 + 5 + 6 + 7` (7 Replies)
I have a lot of very large hex files that I need to change one value at the same offset and save to another file. I have a script that finds each file and just need to put an operator for each file.
I think sed might be able to do this but I have not used it before and would like some help. If... (8 Replies)
hello mates.
please help me out once again.
i have a html file where i want to fetch out one value from the entire html-code
sample html code:
.....
<b>Amount:<b> 12345</div>
...
now i only want to fetch the 12345 from the html document.
how to i tell sed to get me the value from... (2 Replies)
Hi ,
I have written a csh script which will output file named " myoutput.html " displayed below. I am tried to ftp this html file into a local web server so that it can be displayed to public sharing this server and i would want to add a hyperlink to " XX " , " YY " , " ZZ ". Can this be done... (17 Replies)
I have the following
for ((i=100; i<=1000; i++))
do
this goes in increments of 1
I need it to go up in increments of 100, how is that done in a for loop? (1 Reply)