05-09-2012
find from file and replace with specific text
Dear All,
I do not have any knowledge of scripting. I want to replace specific lines of a text file with a specific text. Like I have one file which is "original file" and one file "changes file" which has list of lines which I want to replace in original file with a specific string. I want the script to go through the original file using changes file line by line and change the text as soon as it finds it with the given text and after first occurrence should move to the next line of the changes file and look for the second line and change it with the same given text. the lines in the changes file are kept sequentially in the same order as the original file so the pointer do not need to go back up. Please help. Thanks in advance.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi I have a spaced filled file having records like below:
What I want is to read line having RT3 at position 17-19 then go to position 2651 check the 18 characters (might be space filled till 18 characters). This position should have a... (6 Replies)
Discussion started by: COD
6 Replies
2. UNIX for Dummies Questions & Answers
I have a text file with following content (3 lines)
filename : output.txt
first line:12/12/2008
second line:12/12/2008
third line:Y
I would like to know how we can replace 'Y' with 'N' in the 3rd line keeping 1st and 2nd lines same as what it was before.
I tried using cat output.txt... (4 Replies)
Discussion started by: santosham
4 Replies
3. UNIX for Dummies Questions & Answers
hi all,
i am new bee to Unix.
i know how to replace text for range of lines in vi
for e.g. replace | with |||| for line 4 through 7 using vi
: 4,7s/|/||||/g
but i have to replace | with |||| only for line no 4, 7 and 10 using vi only!!!
your help will be appreciated!
thanks,... (4 Replies)
Discussion started by: pranav.pandya
4 Replies
4. Shell Programming and Scripting
Hi,
I have following samp.txt file in unix.
samp.txt
01Roy2D3M000000
02Rad2D3M222222
.
.
.
.
10Mik0A2M343443
Desired Output
01Roy2A3M000000
02Rad2A3M222222
.
. (5 Replies)
Discussion started by: techmoris
5 Replies
5. Shell Programming and Scripting
I am new to unix and awk/sed etc... using C-Shell.
Basically, I have a fixed length file that has 4 different record types on it, H, D, V, W all in column 1. I need to change all the W's in column 1 to D's. in the entire file. The W's can be anywhere in the file and must remain in the same... (3 Replies)
Discussion started by: jclanc8
3 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I would like to use sed to replace NA to x ('s/NA/x/g'), but only in the 5th column of the space delimited text file, nowhere else. How do I go about doing that? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies
7. UNIX for Advanced & Expert Users
I have two files
a.txt
b.txt
I want to find a line in a.txt and replace by another line from b.txt
a.txt
asfsdfsfsfdfsf
asfwererfgdgf
wrerwetretfdg
b.txt
werdfgdfgf
werergfdgd
sfdfgfgfgfgg
i want to replace the 1st line of a.txt by 1st line of b.txt
i want out put as (5 Replies)
Discussion started by: rammm
5 Replies
8. Shell Programming and Scripting
case "$inputs" in
sapte)
find /pools/home_unix/sapte/work/models/model -name "*.xml" exec rm -i {} \;;
ckm1)
find /pools/home_unix/ckm1/work/models/model -name "*.xml" exec rm -i {}
\;;
I am getting error like as below.
./menu1.sh: line 144: syntax error near unexpected token `)'... (4 Replies)
Discussion started by: lathigara
4 Replies
9. UNIX for Beginners Questions & Answers
Dear all,
I want to find all the "," in my text file and then replace the commas to a tab. I found a script online but I don't know how to modify the script for my case. Any one can help? Thank you.
@echo off &setlocal
set "search=%1"
set "replace=%2"
set "textfile=Input.txt"
set... (2 Replies)
Discussion started by: forevertl
2 Replies
10. UNIX for Beginners Questions & Answers
Dear Unix guru,
I have a .XML file which is being used to load data to oracle. This file comes on unix box and one of the tag in xml is oracle key word. I want to find that tag and replace with new tag on the fly
For example
I will get one of the tag in xml is as below
<from>Test Test... (12 Replies)
Discussion started by: guddu_12
12 Replies
LEARN ABOUT MINIX
pbmtext
pbmtext(1) General Commands Manual pbmtext(1)
NAME
pbmtext - render text into a bitmap
SYNOPSIS
pbmtext [-font fontfile] [-builtin fontname] [-space pixels] [-lspace pixels] [text]
DESCRIPTION
Takes the specified text, either a single line from the command line or multiple lines from standard input, and renders it into a bitmap.
In the bitmap, each line of input is a line of output. Formatting characters such as newline have no effect on the formatting; like any
unprintable character, they turn into spaces.
The bitmap is just wide enough for the longest line of text, plus margins, and just high enough to contain the lines of text, plus margins.
The left and right margins are twice the width of the widest character in the font; the top and bottom margins are the height of the
tallest character in the font. But if the text is only one line, all the margins are half of this.
OPTIONS
-font,-builtin
By default, pbmtext uses a built-in font called bdf (about a 10 point Times-Roman font). You can use a fixed width font by specify-
ing -builtin fixed.
You can also specify your own font with the -font flag. The fontfile is either a BDF file from the X window system or a PBM file.
If the fontfile is a PBM file, it is created in a very specific way. In your window system of choice, display the following text in
the desired (fixed-width) font:
M ",/^_[`jpqy| M
/ !"#$%&'()*+ /
< ,-./01234567 <
> 89:;<=>?@ABC >
@ DEFGHIJKLMNO @
_ PQRSTUVWXYZ[ _
{ ]^_`abcdefg {
} hijklmnopqrs }
~ tuvwxyz{|}~ ~
M ",/^_[`jpqy| M
Do a screen grab or window dump of that text, using for instance xwd, xgrabsc, or screendump. Convert the result into a pbm file.
If necessary, use pnmcut to remove everything except the text. Finally, run it through pnmcrop to make sure the edges are right up
against the text. pbmtext can figure out the sizes and spacings from that.
-space pixels
Add pixels pixels of space between characters. This is in addition to whatever space surrounding characters is built into the font,
which is usually enough to produce a reasonable string of text.
pixels may be negative to crowd text together, but the author has not put much thought or testing into how this works in every pos-
sible case, so it might cause disastrous results.
-B -lspace pixels
Add pixels pixels of space between lines. This is in addition to whatever space above and below characters is built into the font,
which is usually enough to produce a reasonable line spacing.
pixels must be a whole number.
pixels may be negative to crowd lines together, but the author has not put much thought or testing into how this works in every pos-
sible case, so it might cause disastrous results.
USAGE
Often, you want to place text over another image. One way to do this is with ppmlabel. ppmlabel does not give you the font options that
pbmtext does, though.
Another way is to use pbmtext to create an image containing the text, then use pnmcomp to overlay the text image onto your base image. To
make only the text (and not the entire rectangle containing it) cover the base image, you will need to give pnmcomp a mask, via its -alpha
option. You can just use the text image itself as the mask, as long as you also specify the -invert option to pnmcomp.
If you want to overlay colored text instead of black, just use ppmchange to change all black pixels to the color of your choice before
overlaying the text image. But still use the original black and white image for the alpha mask.
If you want the text at an angle, use pnmrotate on the text image (and alpha mask) before overlaying.
SEE ALSO
pnmcut(1), pnmcrop(1), pnmcomp(1), ppmchange(1), pnmrotate(1), pbmtextps(1), ppmlabel(1), pbm(5)
AUTHOR
Copyright (C) 1993 by Jef Poskanzer and George Phillips
28 January 2001 pbmtext(1)