Sponsored Content
Top Forums Shell Programming and Scripting how to dereference the variable in sed editor Post 302205772 by era on Monday 16th of June 2008 08:35:59 AM
Old 06-16-2008
The single quotes prevent the substitution of any shell variables in the sed script. Use double quotes instead.

Code:
sed "s/XXX/${PX}/g" ${TEMPLETE} > ${TEMPLETE}.${PX}

If PX contains any special characters (in particular, slash) you will need to escape or work around those somehow.

Also look into the correct spelling of "template". Furthermore, see UNIX Shell Quote
 

9 More Discussions You Might Find Interesting

1. AIX

How to set path for the EDITOR variable?

For some reason something has changing in my AIX environment where when I type: ACLEDIT filename ...I get: 3002-104 acledit: EDITOR environment variable must be full pathname I know I need to reset the EDITOR variables path to /usr/bin/vi but I can't remember the syntax anyone? (2 Replies)
Discussion started by: heprox
2 Replies

2. UNIX and Linux Applications

vi editor, grep or sed

I'm currently building a system to perfom a check on some operations on a unix system, i'm very new to unix and i need help. i know 'uname' displays the name of the OS been used, but how do u send the content of uname into a directory or file ? (1 Reply)
Discussion started by: dasadino
1 Replies

3. UNIX for Dummies Questions & Answers

Defining EDITOR Variable - Tru64

Hi, I have to edit a lot of partitions soon and wanted to do so with EMACS rather than VI. The "disklabel -e -r disknumber" command picks up VI as it's defined, but how do I set "-e" so it uses EMACS instead please? Thanks...! (2 Replies)
Discussion started by: Bagel08
2 Replies

4. Shell Programming and Scripting

how to dereference a variable in sed

Hi I have a 'sed' editor command trying to update a line in the file: NEW_PX=7777 echo 'PX_LIST="2259 221 270 263 2874" ' | sed "s/PX_LIST="/&${NEW_PX} /" The above command should add value of NEW_PX as the first entry inside the quotes, so the output should look like this: ... (2 Replies)
Discussion started by: aoussenko
2 Replies

5. Shell Programming and Scripting

Insert a line including Variable & Carriage Return / sed command as Variable

I want to instert Category:XXXXX into the 2. line something like this should work, but I have somewhere the wrong sytanx. something with the linebreak goes wrong: sed "2i\\${n}Category:$cat\n" Sample: Titel Blahh Blahh abllk sdhsd sjdhf Blahh Blah Blahh Blahh Should look like... (2 Replies)
Discussion started by: lowmaster
2 Replies

6. UNIX for Dummies Questions & Answers

Help with sed editor

I am a newbie to Unix and Linux, sed "32,45s///g" file : sed "s/\(\)-\(\)/\1\2/g" file How do we describe these commands in English ? Please help. (2 Replies)
Discussion started by: krthknaidu
2 Replies

7. Red Hat

How to pass value of pwd as variable in SED to replace variable in a script file

Hi all, Hereby wish to have your advise for below: Main concept is I intend to get current directory of my script file. This script file will be copied to /etc/init.d. A string in this copy will be replaced with current directory value. Below is original script file: ... (6 Replies)
Discussion started by: cielle
6 Replies

8. Shell Programming and Scripting

Insert charactera in 1st position of specific lines using vi editor or sed command

Dear all, i am having text file like below surya rama ranga laxman rajesh reddy i want add string (OK) before a text from line 3 to 5 the result will be surya rama OK ranga OK laxman OK rajesh reddy (1 Reply)
Discussion started by: suryanarayana
1 Replies

9. UNIX for Advanced & Expert Users

Kernel crash - NULL pointer dereference when calling DEVICE_WRITE from KTHREAD in a USB device drive

I'm writing a simple USB driver to drive a stepper motor based on USB Skeleton 2.2 Driver, kernel 3.8. The basic version is running properly. As a advancement, I introduced KTHREAD to call the DEVICE_WRITE (skel_write) (), so that the driver will be available for other tasks & requests. Calling... (0 Replies)
Discussion started by: miteshgaware
0 Replies
fixnt(1)							      Debian								  fixnt(1)

NAME
fixnt - Filter for the Windows NT postscript printer driver. SYNOPSIS
fixnt < BADFILE.ps > GOODFILE.ps DESCRIPTION
The Windows NT postscript driver has a tendency to make broken postscript files, that are incompatible with psutils. fixnt is a filter that fixes these problems, allowing the use of psnup(1). The filter takes the broken postscript file on stdin, and outputs a fixed postscript file on stdout. It has no other form for invocation and takes no options on the command-line. OPTIONS
fixnt takes no options. BUGS
fixnt does not check for NTPSOct94. For a workaround, use a sed(1) command to replace 'NTPSOct94' with 'NTPSOct95', like so: sed 's/NTPSOct94/NTPSOct95/g' This is particularly important for Windows NT 3.5 users. AUTHOR
fixnt was written by Holger Bauer <Holger.Bauer@topmail.de>, Michael Rath <rath@itsm.uni-stuttgart.de>, and Akim Demaille <demaille@inf.enst.fr>. REPORTING BUGS
Report bugs to the Authors, but avoid sending large postscript files. Patches are always welcome; send to <bauer@itsm.uni-stuttgart.de>. SEE ALSO
psnup(1), sed(1) a2ps February 2003 fixnt(1)
All times are GMT -4. The time now is 02:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy