Sponsored Content
Full Discussion: For loop with sed
Top Forums Shell Programming and Scripting For loop with sed Post 302352137 by Shahul on Thursday 10th of September 2009 12:54:07 PM
Old 09-10-2009
Hi Sick,

Can u make your query very clear....sorry m not able to understand.

let me make it simple:
if you want to take one by one file and replace some certain strings then ..hope below one might help you...

[/CODE]
directory structure:
ls -lrt|nawk '{print $9}'
FILE1
FILE2
FILE3
FILE4
[/CODE]

Code:
for f in `ls -lrt|nawk '{print $9}'`
do
sed -i "s/'string'/'replace'/g" $f
done

Thanks
SHa
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with for loop/sed ?

I have a hostnames file which has: $ cat hostnames.txt serverxx1 serverxx2 serverxx3 My script: #!/bin/sh fileA=build.xml for i in ./hostnames.txt ; do sed 's/createConfig machine="Machine"/createConfig machine=" '$i' "/g' "$fileA" > ./tmpfile done FileA has: createConfig... (2 Replies)
Discussion started by: chiru_h
2 Replies

2. UNIX for Dummies Questions & Answers

sed in a for loop

dear guys, I want to replace the beginning of some lines in a file by (,) The sequence number of lines is located in a file named numbers so, i used this simple script to do so, but it didn't work. it does'nt recognize the $j in the command sed #! /bin/sh for j in `cat numbers` do sed '$j... (6 Replies)
Discussion started by: marwan
6 Replies

3. Shell Programming and Scripting

Using sed with a foreach loop

So I am back again beating my head against the wall with a shell script and getting a headache! I want to change each year in a file (1980, 1981, 1982, 1983, etc.) to the same year followed by a tab. The input is "blah blah (1980) blah blah". I want to get "blah blah (1980 ) blah blah".... (2 Replies)
Discussion started by: Peggy White
2 Replies

4. Shell Programming and Scripting

Loop with sed command to replace line with sed command in it

Okay, title is kind of confusion, but basically, I have a lot of scripts on a server that I need to replace a ps command, however, the new ps command I'm trying to replace the current one with pipes to sed at one point. So now I am attempting to create another script that replaces that line. ... (1 Reply)
Discussion started by: cbo0485
1 Replies

5. UNIX for Dummies Questions & Answers

SED inside while loop

Hi, im having problem creating a loop using my code: aside from the fact that the 1st variable (VAR) does not increment, it loops more than the expected output. for sample purposes, test csv contains 3 lines. #get number of lines in the file lines=$( wc -l < test.csv ) ... (5 Replies)
Discussion started by: paoie
5 Replies

6. Shell Programming and Scripting

Using sed in for loop

I have a file MAT.txt which contains the following data: mat1.txt mat2.txt . . . . mat100.txt I want to remove the '.txt' from every line and have an output file with the following data: mat1 mat2 . . . . mat100 I know this can be done with sed easily for each line, but I do... (8 Replies)
Discussion started by: ursaan
8 Replies

7. Shell Programming and Scripting

Need help using sed inside the loop.

Hi, i have written a script. it collects data based on the sql queries executed by it. i have multiple output files. after the output file is made i need to do some cosmetic changes in the files and then store them. i am unable to use sed conditions inside the loop. see below code for... (3 Replies)
Discussion started by: dazdseg
3 Replies

8. Shell Programming and Scripting

Using variables in a sed loop...

Hi all, I'm trying to search for the first field in a file called vintella.sudoers_1 and then use the result to grep for its match in vintella.sudoers_useralias file but assigning the second field of what it finds to another variable called to_replace. I then want to use that to_replace... (9 Replies)
Discussion started by: Jazmania
9 Replies

9. UNIX for Dummies Questions & Answers

Using sed in a for loop

Hello I have a group of files a1.profile a2.profile a3.profile a4.profile b1.profile b2.profile b3.profile b4.profile These files all have the same first line with a value s1 atop the columns s1_context s1_ref s1_sample s1_% etc I am trying to use sed in a for loop to replace the s1 in the... (2 Replies)
Discussion started by: plumb_r
2 Replies

10. UNIX for Dummies Questions & Answers

Using sed in a for loop

Hi, I have a file called 1.txt, I want to create 2.txt through 100.txt using a for loop. In each instance of the loop, I want to change all "1"'s in the text file to "2"s and so on... I tried the code below to do this: for i in {2..100}; do sed 's/1/$i/g' 1.txt > $i.txt; done but it... (1 Reply)
Discussion started by: evelibertine
1 Replies
latex2png(1)						      General Commands Manual						      latex2png(1)

NAME
latex2rtf - Convert a LaTeX file to a PNG image SYNTAX
latex2png [-hk] [ -H home_directory ] [ -d dots_per_inch ] [ inputfile ] DESCRIPTION
The latex2png command converts a LaTeX file into a PNG graphic. The first page is translated into an image at the specified resolution. -d dots_per_inch Used to specify the number of dots per inch for the output image. Default is 144 dpi. -h Print a short usage note -k Keep intermediate files (for debugging). -H home_dir Add home_dir to the search path for LaTeX. SEE ALSO
latex2rtf (1). For complete, current documentation, refer to the Info file latex2rtf.info, the PDF file latex2rtf.pdf or the HTML file latex2rtf.html which are made from the TeXInfo source file latex2rtf.texi. LATEX2PNG(1) User LATEX2PNG(1) NAME
latex2png - manual page for latex2png 1.1 DESCRIPTION
latex2png -- Convert a LaTeX file to a PNG image USAGE: latex2png [-d density] [-h] [-k] [-c] [-g] [-m] [-H home dir] file[.tex|.eps] The latex2png command converts a LaTeX file into a PNG image. The first page is translated into an image at the specified resolution. latex2png can also be used to convert encapsulated postscript (EPS) files to PNG images. OPTIONS: -c produce color image -d density density is the number of dots per inch to use in the created image (default 144 dpi) -g produce gray images -h help -H home_dir home_dir is a directory to be included in search path (default is directory that contains the LaTeX file). This is used to create PNG images in another directory (e.g., /tmp) and still allow LaTeX to find files that it needs to include. -k keep intermediate files (for debugging) -m produce monochrome (black and white) image (default) -v version EXAMPLES: latex2png -d 144 /tmp/file #create /tmp/file.png at 144 dpi latex2png file.eps #create file.png latex2png file.tex #create file.png via latex latex2png -H . /tmp/file #search the cwd for image files SEE ALSO
latex2png is a part of latex2rtf and has a special mode to assist in finding the baseline of a latex equation. Documentation for latex2rtf may be found in latex2rtf.info, the PDF file latex2rtf.pdf or the HTML file latex2rtf.html which are made from the TeXInfo source file latex2rtf.texi. latex2png 1.10 November 2002 LATEX2PNG(1)
All times are GMT -4. The time now is 05:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy