Sponsored Content
Top Forums Shell Programming and Scripting Passing backslash character to awk variable Post 302732523 by Scrutinizer on Sunday 18th of November 2012 08:00:52 AM
Old 11-18-2012
For reference, awk use of variables. There is no need to escape the double quote:
Code:
awk '$0~b,$0~e' b='select_id="x_0' e='from' infile


--
On Solaris, use /usr/xpg4/bin/awk
These 2 Users Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How ro handle backslash character in grep?

Hi , I am doing invert grep using -v but the string contain "/" which break the grep command and it do not skip the lines with "/" on it. Diffu.txt ======== 1159c1159 < <td align="right" valign="middle" class="paddingRight2px" id="featureListItemChannelButton7466"> --- > <td... (1 Reply)
Discussion started by: rajbal
1 Replies

2. Shell Programming and Scripting

remove backslash character from file

How do I remove a backslash character \ from a file? I have used sed -e "s|\||g" filename > newfile I have done several permutations on this to no avail such as: sed -e "s|`\`||g" filename > newfile sed -e "s|""\""||g" filename > newfile What am I doing wrong?:confused: ... (2 Replies)
Discussion started by: MissI
2 Replies

3. Shell Programming and Scripting

Passing variable and wild card character to grep in Perl

HI All, I have a script that needs to find out a list of files in a directory, i pass the search parameter as an argument. opendir ( DIR, $dir ) || die "Error in opening dir $dirname\n"; @filename1 = (grep {/$File_pattern/ } readdir(DIR)); The problem is my file patterns are like... (1 Reply)
Discussion started by: amit1_x
1 Replies

4. Shell Programming and Scripting

passing double backslash(\\) as a path in unix

Hi All, I am trying to add a tag in the *.imp file. This is a piece of code which I am giving in my template file and my script reads this template file attachment and passes to windows server(as they have provided the below file path). ... (3 Replies)
Discussion started by: defendersubbu
3 Replies

5. Shell Programming and Scripting

Passing variable to awk

Hi, I'm new with this stuff, but I hope you can help me. This is what I'm trying to do: for id in $var; do awk '{if ($1 == $id) print $2}' merg_data.dat > neigh.tmp done I need that for every "id", awk search the first column of the file merg_data.dat which contains "id" and... (3 Replies)
Discussion started by: matteo86
3 Replies

6. Shell Programming and Scripting

Passing awk variable argument to a script which is being called inside awk

consider the script below sh /opt/hqe/hqapi1-client-5.0.0/bin/hqapi.sh alert list --host=localhost --port=7443 --user=hqadmin --password=hqadmin --secure=true >/tmp/alerts.xml awk -F'' '{for(i=1;i<=NF;i++){ if($i=="Alert id") { if(id!="") if(dt!=""){ cmd="sh someScript.sh... (2 Replies)
Discussion started by: vivek d r
2 Replies

7. Shell Programming and Scripting

awk programming -Passing variable to awk for loop

Hi All, I am new to AWK programming. I have the following for loop in my awk program. cat printhtml.awk: BEGIN -------- <some code here> END{ ----------<some code here> for(N=0; N<H; N++) { for(M=5; M<D; M++) print "\t" D ""; } ----- } ... (2 Replies)
Discussion started by: ctrld
2 Replies

8. Shell Programming and Scripting

Replace special characters with backslash and character

Hi, I have a string wherein i need to replace special characters with backslash and that character. Ex: If my string is a=qwerty123@!, then the new string should be a_new=qwerty123\@\!\, Thanks (3 Replies)
Discussion started by: temp_user
3 Replies

9. Shell Programming and Scripting

[BASH] Getting a semi-tailing backslash when passing (escaped) variables to script

Heyas Figured me had a 'typo' in tui-conf-set, i went to fix it. Now, i also figured, it might be nice to have tui-conf-set report (to console, not only exit code) wether it could save the variable to the file or not. This said, I appended this code: (the tui-title and tui-echo lines are... (3 Replies)
Discussion started by: sea
3 Replies

10. Shell Programming and Scripting

awk with passing variable

I have file called in in.txt contains with the below lines I want to display the lines between the value which I would be passing. one two three four five ten six seven eight Expected output if I have passed one and ten two three four five (8 Replies)
Discussion started by: mychbears
8 Replies
MATCH(1L)						      Schily's USER COMMANDS							 MATCH(1L)

NAME
match - searches for patterns in files SYNOPSIS
match [ -option ] pattern [ file ... ] DESCRIPTION
Match searches the named files or standard input (if no filenames are given) for the occurrences of the given pattern on each line. The program accepts literal characters or special pattern matching characters. All lines that match the pattern are output on standard output. You can only specify one pattern string for each match, however, you can construct an arbitrarily complex string. When you do not specify a file, match can be used as a filter to display desired lines. Standard in is used if no files are specified. OPTIONS
-not, -v Prints all lines that do not match. -i Ignore the case of letters -m Force not to use the magic mode -w Search for pattern as a word -x Display only those lines which match exactly -c Display matching count for each file -l Display name of each file which matches -s Be silent indicate match in exit code -h Do not display filenames -n Precede matching lines with line number (with respect to the input file) -b Precede matching lines with block number REGULAR EXPRESSIONS
The following is a table of all the pattern matching characters: c An ordinary character (not one of the special characters discussed below) is a one character regular expression that matches that character. c A backslash () followed by any special character is a one character regular expression that matches the special character itself. The special characters are: ! # % * { } [ ] ? ^ $ ! Logical OR as in match this!that!the_other. You may have to use `{}' for precedence grouping. # A hash mark followed by any regular expression matches any number (including zero) occurrences of the regular expression. ? Matches exactly any one character. W? matches Wa, Wb, Wc, W1, W2, W3 ... * Matches any number of any character. % Matches exactly nothing. It can be used in groups of ored patterns to specify that an empty alternative is possible. {} Curly brackets may be used to enclose patterns to specify a precedence grouping, and may be nested. {%!{test}}version matches the strings testversion and version. [string] A non empty string of characters enclosed in square brackets is a one character regular expression that matches any one character in that string. If however the first character of the string is a circumflex (^), the one character expression matches any character which is not in the string. The ^ has this special meaning only if it occurs first in the string. The minus (-) may be used to indi- cate a range of consecutive ASCII characters; for example, [0-9] is equivalent to any one of the digits. The - loses it's special meaning if it occurs first (after an initial ^, if any) or last in the string. The right square bracket (]) and the backslash () must be quoted with a backslash if you want to use it within the string. ^ Matches the beginning of a line. $ Matches the end of a line. (^*$ matches any entire line) EXAMPLES
FILES
None. SEE ALSO
grep(1), fgrep(1), egrep(1) DIAGNOSTICS
NOTES
Even if a match occurs more than once per line, the line is output only once. Quote special pattern matching characters to prevent them from being expanded by the Command Interpreter. BUGS
The length of the pattern is currently limited to 100 characters. This limit is reduced by 38 if the -w option is used. Joerg Schilling 15. Juli 1988 MATCH(1L)
All times are GMT -4. The time now is 02:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy