Sponsored Content
Top Forums Shell Programming and Scripting AWK or SED to add string at specific position Post 302400918 by frans on Thursday 4th of March 2010 12:41:51 PM
Old 03-04-2010
try
Code:
sed 's/client04/newclient04/' last.cfg

to see what will happen (outpuit to screen)
if your sed version accepts the '-i' for "in place" then
Code:
sed -i 's/client04/newclient04/' last.cfg

to modify the file
if you use variables, then use double quotes like
Code:
sed "s/${TO_SEARCH}/${TO_INSERT}${TO_SEARCH}/" last.cfg

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to add character in specific position of a string?

Hi All, I would like to use sed to add "-" between the following string: Value: 20060830 Result: 2006-08-30 Pls advice. Thx a lot Victor (5 Replies)
Discussion started by: victorlung
5 Replies

2. Shell Programming and Scripting

search a line and insert string into specific at position

Hi, guys. I have one question: How can I search for a line with certain string in it and then insert a string into this line? For example: There is a file called shadow, the contents of it are below: ************************** ... yuanz:VIRADxMsadfDF/Q:0:0:50:7:::... (9 Replies)
Discussion started by: daikeyang
9 Replies

3. Shell Programming and Scripting

Using sed to replace specific character and specific position

I am trying to use sed to replace specific characters at a specific position in the file with a different value... can this be done? Example: File: A0199999123 A0199999124 A0199999125 Need to replace 99999 in positions 3-7 with 88888. Any help is appreciated. (5 Replies)
Discussion started by: programmer22
5 Replies

4. Shell Programming and Scripting

awk or sed command to print specific string between word and blank space

My source is on each line 98.194.245.255 - - "GET /disp0201.php?poc=4060&roc=1&ps=R&ooc=13&mjv=6&mov=5&rel=5&bod=155&oxi=2&omj=5&ozn=1&dav=20&cd=&daz=&drc=&mo=&sid=&lang=EN&loc=JPN HTTP/1.1" 302 - "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.0.3705; .NET CLR... (5 Replies)
Discussion started by: elamurugu
5 Replies

5. Shell Programming and Scripting

Remove text from n position to n position sed/awk

I want to remove text from nth position to nth position couple of times in same line my line is "hello is there anyone can help me with this question" I need like this ello is there anyone can help me with question 'h' is removed and 'this' removed from the line. I want to do this... (5 Replies)
Discussion started by: elamurugu
5 Replies

6. Shell Programming and Scripting

substitute a string on a specific position for specific lines

I woud like to substitue a string on a specific position for specific lines I've got a file and I would like to change a specific string from "TOCHANGE" to "ABCABCAB" For every line (except 1,2, 3 and the last one) , I need to check between the 9th and the 16th digits. For the 3rd line, I... (7 Replies)
Discussion started by: BSF
7 Replies

7. Shell Programming and Scripting

Sed position specific replace

I'm drawing a blank on how to use sed to replace selectively based on position in the string (vs nth occurence): hello.|there.|how.|are.|you.| I want the period removed in the 3rd item (as defined by the pipe delimiter) if a period is present. So the result in this case would be: ... (2 Replies)
Discussion started by: tiggyboo
2 Replies

8. Shell Programming and Scripting

Using sed to replace a string in a specific position

I asked this before, but my problem got more complicated. Heres what I am trying to do: I'm trying to replace a string at a certain location with another string. Heres the file I'm trying to change: \E I want to replace the escape code at the 3rd line, 2nd column with this escape code... (3 Replies)
Discussion started by: tinman47
3 Replies

9. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

10. Shell Programming and Scripting

awk partial string match and add specific fields

Trying to combine strings that are a partial match to another in $1 (usually below it). If a match is found than the $2 value is added to the $2 value of the match and the $3 value is added to the $3 value of the match. I am not sure how to do this and need some expert help. Thank you :). file ... (2 Replies)
Discussion started by: cmccabe
2 Replies
TTF2UFM_X2GS(1) 					      TTF2UFM Font Converter						   TTF2UFM_X2GS(1)

NAME
ttf2ufm_x2gs - font installer for Ghostscript SYNOPSIS
ttf2ufm_x2gs [config-file] DESCRIPTION
The fonts generated with ttf2ufm work fine with Ghostscript by themselves. The script `x2gs' (or `ttf2ufm_x2gs' when installed into a public directory, to avoid name conflicts with other programs) links the font files from the X11 direcotry into the Ghostscript directory and automatically creates the description file ("Fontmap") in Ghostscript format. If the configuration file is not specified as an argument then the file `"convert.cfg"' in the current directory is used, just like the `"convert"' script does. Indeed, this configuration file is used for both scripts. The Ghostscript-related parameters in the configuration file are: "DSTDIR" - the X11 font directory used by `"x2gs"' as the source of the fonts. This parameter is common with the X11 configuration. "GSDIR" - the base directory of Ghostsript. If this parameter is set to an empty string then `"convert"' won't call `"x2gs"'. So if you want to get only the X11 fonts installed then set this parameter to an empty string. This directory may vary on various system, so please check your system and set this value accordingly before running the script. "GSFONTDIR" - the font directory of Ghostscript. In the standard Ghostscript installation it's a subdirectory of "GSDIR" but some systems may use completely different directories. "GSCONFDIR" - the configuration subdirectory of Ghostscript that contains the "Fontmap" file. "INSTALLFONTMAP" - if the value is set to "YES" then install the entries for the new fonts right into the main "Fontmap" file. Otherwise just leave the file "Fontmap.ttf" in the Ghostscript configuration directory. After preparing the configuration file run the script. It symbolicaly links all the font files and creates the description file "Fontmap.ttf" in "GSCONDFIR". After that there are two choices. If the option "INSTALLFONTMAP" was set to "YES" then the font descriptions are also automatically installed into the master "Fontmap" file. The script is clever enough to detect if it was run multiple times with the same directories and if so it replaces the old "Fontmap" entries with the new ones instead of just accumulating all of them. You may also run it multiple times for multiple X11 directories and all the results will be properly collected in the "Fontmap". But it's your responsibility to watch that the names of the font files don't overlap. If the X11 font directory gets renamed then you have to remove its font entries from the "Fontmap" and only after that re-run `"x2gs"' for the new directory. On the other hand if the option "INSTALLFONTMAP" was set to "NO" then go to the "GSCONFDIR" directory and insert the contents of "Fontmap.ttf" into the "Fontmap" file manually. This step may be left manual to make the installation a little bit more safe. After that you may also want to redefine some of the aliases in "Fontmap" to refer to the newly installed fonts. But the redefinition of the aliases may be dangerous if the width of characters in the new font will be different from the old font. Alas, there is no visible solution of this problem yet. FILES
o TTF2UFM_SHAREDIR/scripts/convert.cfg.sample o TTF2UFM_SHAREDIR/scripts/* o TTF2UFM_SHAREDIR/README o TTF2UFM_SHAREDIR/FONTS o TTF2UFM_SHAREDIR/* o TTF2UFM_BINDIR/ttf2ufm SEE ALSO
o ttf2ufm(1) o ttf2ufm_convert(1) o t1asm(1) version 3.4.4 December 31, 2003 TTF2UFM_X2GS(1)
All times are GMT -4. The time now is 06:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy