12-21-2004
Command param subst to reg expression
I want to find out Row which starts with, the user specified details to a script.
In general I know what command to be given.
awk '$0~/^Vi/' BReject
But I need to pass on $1 param of command line at the place of 'Vi'.
I tried with -v subst=$1
awk -v subst=$1 '$0~/^subst/' BReject
But it couldnt work.
Any suggestions, Solution must be restricted to awk.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I need help with this:
Can any one tell me what does these below mean:
1. "\(.\).*") != '/'
2. sed 's+^\./++;s+/.*++'
3. sed "s+${f}/+ +
Thanks in advance (7 Replies)
Discussion started by: moe2266
7 Replies
2. Shell Programming and Scripting
Hi,
I'm quite new to scripting and I want to modify following line of an existing script:
MYVAR=`subst |grep 'L:\\\:' | sed -e 's/.*\\\//'`;
What I have to do is to use the content of a variable instead of the constant expression 'L:\\\:' as the grep string to be matched.
Assuming I already... (5 Replies)
Discussion started by: snowbiker99
5 Replies
3. Shell Programming and Scripting
I have regular expression like this ( replace + with \+)
($mod_server) = ($server =~ /\+/\\+/g);
the above is failing with error . what's wrong with it .
Thanks (1 Reply)
Discussion started by: talashil
1 Replies
4. Shell Programming and Scripting
HI
system.sysUpTime.0 : Timeticks: (1519411311) 175 days, 20:35:13.11
From the above output i need only 175days in a perl script..
Please Help (2 Replies)
Discussion started by: Harikrishna
2 Replies
5. Shell Programming and Scripting
Hello,
I have thousand of messages (HL7), I want to use awk to extract only the ones that have a particular value in pv1.18
Each record in the file is the whole HL7 message, ie. when I print $0 I get the whole message MSH EVN PID etc. ,there is an x0d between the segments.
I would like to use a... (3 Replies)
Discussion started by: gio001
3 Replies
6. Shell Programming and Scripting
Please let me understand this reg expression
(\s+')(.*)('\s+)(.)(.*)(\/.*)/)
i have doubt in the below 2.I'm not understanding why back-tick used?
(\s+') and ('\s+) (2 Replies)
Discussion started by: dll_fpga
2 Replies
7. Shell Programming and Scripting
./GEN_SCR.pl -f ${REP_PATH}/FUNCTIONAL/wide1c_1.0V/max/qor.rpt -o ${REP_PATH}/FUNCTIONAL/GEN2_wide1c_1.0V_max.csv
where GEN_SCR.pl is as below...i need to check whether max or min is coming in the argument to the script ...how to do this?
${REP_PATH}/FUNCTIONAL/wide1c_1.0V/max/qor.rpt ... (0 Replies)
Discussion started by: dll_fpga
0 Replies
8. Shell Programming and Scripting
how to uniquely match each of the words seperated by / in perl
${REP_PATH}/FUNCTIONAL/wide1c_1.0V/max/qor.rpt
https://www.unix.com/images/misc/progress.gif (5 Replies)
Discussion started by: dll_fpga
5 Replies
9. Shell Programming and Scripting
I want to make a REG Expression to validate the directory.
my dirsample is below:
/abc/abc/abc
abc/abc/abc
abc/abc/abc/
/abc/a bc/abc
/a bc/abc/abc
/abc/abc/a bc
/ abc/abc/abc
/abc/ abc/abc
/abc/.abc
/.abc/abc
/
//
/abc
/.abc
And my code is below:
grep -E '^\/(+\/?)+$' dirsample (4 Replies)
Discussion started by: franksunnn
4 Replies
10. Shell Programming and Scripting
Need your help in creating regular expression for particular set. let say I have given two dates 20130623 to 20140625.
I need to create regular for the dates which fall in between above two dates. (4 Replies)
Discussion started by: gvkumar25
4 Replies
SUBST(1) General Commands Manual SUBST(1)
NAME
subst - substitute definitions into file(s)
SYNOPSIS
subst [ -e editor ] -f substitutions victim ...
DESCRIPTION
Subst makes substitutions into files, in a way that is suitable for customizing software to local conditions. Each victim file is altered
according to the contents of the substitutions file.
The substitutions file contains one line per substitution. A line consists of two fields separated by one or more tabs. The first field
is the name of the substitution, the second is the value. Neither should contain the character `#', and use of text-editor metacharacters
like `&' and `' is also unwise; the name in particular is best restricted to be alphanumeric. A line starting with `#' is a comment and
is ignored.
In the victims, each line on which a substitution is to be made (a target line) must be preceded by a prototype line. The prototype line
should be delimited in such a way that it will be taken as a comment by whatever program processes the file later. The prototype line must
contain a ``prototype'' of the target line bracketed by `=()<' and `>()='; everything else on the prototype line is ignored. Subst
extracts the prototype, changes all instances of substitution names bracketed by `@<' and `>@' to their values, and then replaces the tar-
get line with the result.
OPTIONS
-e Substitutions are done using the sed(1) editor, which must be found in either the /bin or /usr/bin directories. To specify a dif-
ferent executable, use the ``-e'' flag.
EXAMPLE
If the substitutions file is
FIRST 111
SECOND 222
and the victim file is
x = 2;
/* =()<y = @<FIRST>@ + @<SECOND>@;>()= */
y = 88 + 99;
z = 5;
then ``subst -f substitutions victim'' changes victim to:
x = 2;
/* =()<y = @<FIRST>@ + @<SECOND>@;>()= */
y = 111 + 222;
z = 5;
FILES
victimdir/substtmp.new new version being built
victimdir/substtmp.old old version during renaming
SEE ALSO
sed(1)
DIAGNOSTICS
Complains and halts if it is unable to create its temporary files or if they already exist.
HISTORY
Written at U of Toronto by Henry Spencer.
Rich $alz added the ``-e'' flag July, 1991.
BUGS
When creating a file to be substed, it's easy to forget to insert a dummy target line after a prototype line; if you forget, subst ends up
deleting whichever line did in fact follow the prototype line.
25 Feb 1990 SUBST(1)