Sponsored Content
Top Forums Shell Programming and Scripting Sed variable substitution when variable constructed of a directory path Post 302213959 by joeyg on Friday 11th of July 2008 02:09:32 PM
Old 07-11-2008
Hammer & Screwdriver try a different format for the sed

Code:
sed "s/99998/"$jobnum"/g;" $src"j99998a.pst" > "j"$jobnum"a.pst"

changes 99998 to my stored $jobnum
starting with my j99998a.pst file (using $src as path location)
and outputting to new name with my $jobnum as the new filename

Just follow all of the double quotes to make sure variables all line up correctly.

I actually do several of these when setting up repetitive work - copying a global use file and customizing it for my current job/task. (By habit, I use 99998 as a dummy number - I found that using 99999 could run into issues since "99999" could be a mask for outputs or other uses.)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to use sed substitution using a $variable for a line containing a word

$ cat ggg /E*Fare/testteam/public/pf3/nggfstatic/4k-pf3_3.case REGION1: /E*Fare/dist/src/nggfstaticbase/EFare/Server CODEBASE1: /dev_tools/LINUXMTP-4/EFS070718E/EFare/Server DATABASE1: nggfstatic SCRIPT: /efare1/admin/ezlcn/scripts/pf3_3_scriptlist.input PROLOGINITSIZE not yet set You... (4 Replies)
Discussion started by: Sangal-Arun
4 Replies

2. Shell Programming and Scripting

how to do variable substitution in 'sed'

I have a 'sed' editor command trying to read contents of one file into another. v=t1 PX=25 sed '/for/ r /$v/ext/tsfirmfiles.${PX}' /bb/bin/px${PX}.files.2b.deleted > result I cannot come up with the syntax so 'sed' would do a variable substitution. Any idea? Thanks a for help. -A (1 Reply)
Discussion started by: aoussenko
1 Replies

3. Shell Programming and Scripting

sed variable substitution problem

Hi, I am facing a strange problem. I have a script that used the following to search and replace text: sed 's/'"${find_var_parm}"'/'"${find_var_filter}"'/g' $ParmFile > $TempFile The values of $find_var_parm and $find_var_filter are set based on search criteria. The above seems to be working... (2 Replies)
Discussion started by: arsh
2 Replies

4. Shell Programming and Scripting

SED variable substitution

Hi Chaps... I have a log file as below:- 01 Oct 2009 12:57:56 DEBUG : 01 Oct 2009 12:14:21 DEBUG :..... . . . .05 Oct 2009 14:31:56 DEBUG :.... . . .05 Oct 2009 12:57:56 DEBUG :.... 06 Oct 2009 01:23:11 DEBUG :.... . . .06 Oct 2009 12:53:46 DEBUG :.... (4 Replies)
Discussion started by: rpraharaj84
4 Replies

5. Shell Programming and Scripting

variable substitution in sed

Hi, I have to insert a line at a particular line number in my file. But the line number is not fixed and it will vary every time. So, I have to use a variable to get the line number I know we can use sed to insert lines at a particular line number but it does not work with variable... (3 Replies)
Discussion started by: sugan
3 Replies

6. Shell Programming and Scripting

Simple sed variable substitution

Give the code: set line = 2 set year = `sed -n '2p' file while ($line < 500) echo $line > f.txt @ line = $line + 1 end How do I utilize the variable $line in the code instead of the number 2. I'm using this in a while loop and counter. I've tried quoting it, double/single... (1 Reply)
Discussion started by: wxornot
1 Replies

7. Shell Programming and Scripting

Sed variable substitution

Hello, I searched the forum and unable to find a solution for my particular problem. I have a text file I'm trying to insert some text using sed after finding a pattern.. File contains in one line Invoice date: xx/xx/xxxx Balance: $$$$ Name: xxxxxxxxxxxxxx Trying to insert Invoice "Number:... (3 Replies)
Discussion started by: mallu0987
3 Replies

8. Shell Programming and Scripting

Sed - variable substitution

Problem with the code below is that the value of the variable is not getting substituted in the sed expression. #/bin/csh set UNIX_ID="rajibd" set X_ID="xrajibd" sed -n 's/$UNIX_ID/$X_ID/g' passwd When run , it is not giving expected output as shown below : ... (4 Replies)
Discussion started by: hiten.r.chauhan
4 Replies

9. Shell Programming and Scripting

sed variable substitution in a script

Hi I am trying to do the following in a script find a string and add in a block of text two lines above on the command line this works fine #/usr/bin/cat /usr/local/etc/dhcpd.conf_subnet | /usr/xpg4/bin/sed -n -e '1h;1\!H;${;g;s/}.*#END of 10.42.33.0/#START of RANGE $dstart\:option... (3 Replies)
Discussion started by: eeisken
3 Replies

10. Shell Programming and Scripting

sed variable expansion fails for substitution in range

I'm trying to change "F" to "G" in lines after the first one: 'FUE.SER' 5 1 1 F0501 F0401 F0502 2 1 F0301 E0501 F0201 E0502 F0302 3 1 F0503 E0503 E0301 E0201 E0302 E0504 F0504 4 1 F0402 F0202 E0202 F0101 E0203 F0203 F0403 5 1 F0505 E0505 E0303 E0204 E0304 E0506... (10 Replies)
Discussion started by: larrl
10 Replies
PST2LDIF(1)						  libpst Utilities - Version 0.6					       PST2LDIF(1)

NAME
pst2ldif - extract contacts from a MS Outlook .pst file in .ldif format SYNOPSIS
pst2ldif [-V] [-b ldap-base] [-c class] [-d debug-file] [-l extra-line] [-o] [-h] pstfilename OPTIONS
-V Show program version. Subsequent options are then ignored. -b ldap-base Sets the ldap base value used in the dn records. You probably want to use something like "o=organization, c=US". -c class Sets the objectClass values for the contact items. This class needs to be defined in the schema used by your LDAP server, and at a minimum it must contain the ldap attributes given below. This option may be specified multiple times to generate entries with multiple object classes. -d debug-file Specify name of debug log file. The log file is now an ascii file, instead of the binary file used in previous versions. -l extra-line Specify an extra line to be added to each ldap entry. This option may be specified multiple times to add multiple lines to each ldap entry. -o Use the old ldap schema, rather than the default new ldap schema. The old schema generates multiple postalAddress attributes for a single entry. The new schema generates a single postalAddress (and homePostalAddress when available) attribute with $ delimiters as specified in RFC4517. Using the old schema also generates two extra leading entries, one for "dn:ldap base", and one for "dn: cn=root, ldap base". -h Show summary of options. Subsequent options are then ignored. DESCRIPTION
pst2ldif reads the contact information from a MS Outlook .pst file and produces a .ldif file that may be used to import those contacts into an LDAP database. The following ldap attributes are generated for the old ldap schema: cn givenName sn personalTitle company mail postalAddress l st postalCode c homePhone telephoneNumber facsimileTelephoneNumber mobile description The following attributes are generated for the new ldap schema: cn givenName sn title o mail postalAddress homePostalAddress l st postalCode c homePhone telephoneNumber facsimileTelephoneNumber mobile description labeledURI COPYRIGHT
Copyright (C) 2008 by 510 Software Group <carl@five-ten-sg.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, please write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. VERSION
0.6.59 pst2ldif 0.6.59 2011-05-27 PST2LDIF(1)
All times are GMT -4. The time now is 07:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy