05-06-2005
doing a sed with variables
Hi,
I'm trying to do the following , I have certain variables in a file and then I want to check for these variables in a certain cobol file to see if they contain a certain package if so replace them with value 1 but but that last line is giving problems:
# for each variable in SQL file
for var in `strings $file.vars`
do
# Set char /int patterns
pat_int="^.*$var.*PIC.*9.*$"
if grep "$pat_int" $cobol_file > /dev/null 2>&1
then
value="1"
# substitute variable in SQL file
sed s/:$var/$value/g $file.out > $file.varsub
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I'm trying to do the following , I have certain variables in a file and then I want to check for these variables in a certain cobol file to see if they contain a certain package if so replace them with value 1 but but that last line is giving problems:
# for each variable in SQL file
... (1 Reply)
Discussion started by: seaten
1 Replies
2. UNIX for Dummies Questions & Answers
Hi guys,
I want to replace certain values with the number 1.
But it is also replacing other values which contain the value I want to replace. e.g.:
I want to replace ID-INTERNAL with 1, that's no problem but it will also replace ID-INTERNAL-NON-REM with 1-NON-REM
I don't want to... (10 Replies)
Discussion started by: seaten
10 Replies
3. Shell Programming and Scripting
when i do something like substituting a particular thing with a system variable, i am unable to do that expect the varible name getting into that.
for ex.. i tried,
sed -e 's/date/`date`/g' <if >of
but i got date replaced with "`date`" and not with the actual date ..
same case happened... (5 Replies)
Discussion started by: sskb
5 Replies
4. Shell Programming and Scripting
Hi,
I'm trying to use sed to delete the last three lines of a file. I currently have:
# get the amount of lines in the file
foldernum=`wc -l File_In.txt | cut -c1-8`
# remove the lines in the file
sed "${foldernum}-3,${foldernum}d" File_In.txt > File_Out.txt
I get the error - sed:... (5 Replies)
Discussion started by: Mr_Plow
5 Replies
5. Shell Programming and Scripting
HELP!!!
I'm keep getting "sed: Function s/PETS/dog cannot be parsed."
I have 2 files that list...
# cat FILE1.txt
dog
cat
mouse
# cat FILE2.txt
my pets are
PETS
I put this into a variable...
# A=`cat FILE1.txt`
# sed "s/PETS/$A" FILE2.txt > FILE3.txt (5 Replies)
Discussion started by: Zenwork
5 Replies
6. Shell Programming and Scripting
I'm trying to get sed to cut and replace using variables, but it doesnt seem to work, when I run this the mod time of the file does get updated. Is my syntax incorrect in the sed command?
Thanks
#!/usr/bin/ksh
#Modify header
set -x
HEAD=$(cat PBN2CPR1.TXT | awk 'BEGIN { FS = ","... (1 Reply)
Discussion started by: ddurden7
1 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I am able to use sed if I hardcode the find and replace values in a shell script.
This works:
sed -e 's/123v/4567/g' /path/aaa.txt
> /path/aaa.txt.tmp
If I use a variable, I am not able to use sed command. why?
This doesnot work:
i=abc
j=bk${i}
sed -e 's/${i}/${j}/g'... (5 Replies)
Discussion started by: new_learner
5 Replies
8. Shell Programming and Scripting
Is it possible to place a variable in a sed command as such?
sed 's/ret_Priv()/$var/' <filename>
I am doing this under Bourne. (5 Replies)
Discussion started by: plslakewood
5 Replies
9. Shell Programming and Scripting
All
I am trying to produce the following in /etc/ssh/sshd_config,
# IPv4 only
#ListenAddress 0.0.0.0
# IPv4 & IPv6
ListenAddress ::
to
# IPv4 only
ListenAddress <user-entry>
ListenAddress <user-entry>
# IPv4 & IPv6
#ListenAddress ::
The number of user entries can vary.
... (1 Reply)
Discussion started by: miyoung999
1 Replies
10. Shell Programming and Scripting
Im trying to use sed to print value that matches the value in variable and all lines after that.
grep "Something" test.txt | sed -e '/{$variable}/,$b' -e 'd'
I cant get it work, if I replace the $variable with the value it contains, it works fine... (10 Replies)
Discussion started by: olkkis
10 Replies
LEARN ABOUT XFREE86
devscripts.conf
DEVSCRIPTS.CONF(5) File Formats Manual DEVSCRIPTS.CONF(5)
NAME
devscripts.conf - configuration file for the devscripts package
DESCRIPTION
The devscripts package provides a collection of scripts which may be of use to Debian developers and others wishing to build Debian pack-
ages. Many of these have options which can be configured on a system-wide and per-user basis.
Every script in the devscripts package which makes use of values from these configuration files describes the specific settings recognised
in its own manpage. (For a list of the scripts, either see /usr/share/doc/devscripts/README.gz or look at the output of dpkg -L devscripts
| grep /usr/bin.)
The two configuration files are /etc/devscripts.conf for system-wide defaults and ~/.devscripts for per-user settings. They are written
with bash(1) syntax, but should only have comments and simple variable assignments in them; they are both sourced (if present) by many of
the devscripts scripts. Variables corresponding to simple switches should have one of the values yes and no; any other setting is regarded
as equivalent to the default setting.
All variable names are written in uppercase, and begin with the script name. Package-wide variables begin with "DEVSCRIPTS", and are
listed below, as well as in the relevant manpages.
For a list of all of the available options variables, along with their default settings, see the example configuration file
/usr/share/doc/devscripts/devscripts.conf.ex. This is copied to /etc/devscripts.conf when the devscripts package is first installed.
Information about configuration options introduced in newer versions of the package will be appended to /etc/devscripts.conf when the pack-
age is upgraded.
Every script which reads the configuration files can be forced to ignore them by using --no-conf as the first command-line option.
PACKAGE-WIDE VARIABLES
The currently recognised package-wide variables are:
DEVSCRIPTS_CHECK_DIRNAME_LEVEL, DEVSCRIPTS_CHECK_DIRNAME_REGEX
These variables control scripts which change directory to find a debian/changelog file or suchlike, and some other miscellaneous
cases. In order to prevent unwanted, even possibly dangerous, behaviour, these variables control when actions will be performed.
The scripts which currently make use of these variables are: debc, debchange/dch, debclean, debi, debrelease, debuild and uscan, but
this list may change with time (and I may not remember to update this manpage). Please see the manpages of individual scripts for
details of the specific behaviour for each script.
SEE ALSO
devscripts(1) and /usr/share/doc/devscripts/README.gz.
AUTHOR
This manpage was written for the devscripts package by the package maintainer Julian Gilbey <jdg@debian.org>.
DEBIAN Debian Utilities DEVSCRIPTS.CONF(5)