Sponsored Content
Top Forums Shell Programming and Scripting SED command help: Can we pass predefined variables in place of regex Post 302299197 by cfajohnson on Thursday 19th of March 2009 12:16:11 PM
Old 03-19-2009

Yes, it is possible, but you must enclose the sed command in double quotes not single quotes.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

assigning variables in sed command

I need to assign a variable within a variable in a sed command. I tried doing the following in c shell. set left = 1 set right = 2 set segment = qwerty sed -n -e "/$segment{$left}/,/$segment{$right}/p" file.txt what is wrong with this syntax? (3 Replies)
Discussion started by: wxornot
3 Replies

2. UNIX for Dummies Questions & Answers

sed command not work with variables?

I am trying to write a simple script which will take a variable with sed to take a line out of a text and display it #!/bin/sh exec 3<list while read list<&3 do echo $list sed -n '$list p'<list2 done this does not work, yet when I replace the $list variable from the sed command and... (1 Reply)
Discussion started by: MaestroRage
1 Replies

3. Shell Programming and Scripting

Using SED command in a shell script: Unterminated address regex

Hi All, I am trying to use a sed command in a shell script in order to delete some lines in a file and I got the following error message. I don't understand why it is not working 'cause I have tried with simple quotes, then with double-quotes, and it is not working. sed: -e expression #1,... (7 Replies)
Discussion started by: Alpha3363
7 Replies

4. Shell Programming and Scripting

Place variables at the beginning of each line

Hello all, I am very new to the shell scripting and I hope someone can help me with this. I have thousands of files with certain format of information and I need to do this for all my files. For each file, grab the numbers in the first and second rows and place them in the position 1 and 2... (8 Replies)
Discussion started by: GoldenFire
8 Replies

5. Shell Programming and Scripting

Variables in SED command

Hi all, I want write a script to display 5rows at times from a input file. my out like: echo " display started" r1 r2 r3 r4 r5 ... Some action items... again i need next 5 lines. can you please advise. (2 Replies)
Discussion started by: koti_rama
2 Replies

6. Shell Programming and Scripting

Place digit in front of the line searching pattern using sed command

hi All, i want to add the single digit front of the line in the report file and string compare with pattern file. patter file: pattern1.txt pattern num like 4 love 3 john 2 report file: report.txt i like very much but john is good boy i will love u so after execute... (9 Replies)
Discussion started by: krbala1985
9 Replies

7. UNIX for Dummies Questions & Answers

How to pass variables in Expect command?

Hi All, I need to frame a unix script to logon to a unix box. The credentials needs to be obtained from a property file on the same location. I am trying to use 'expect' and 'spawn' command to meet this req. When I am passing values, these commands are working fine. but when I am trying to... (3 Replies)
Discussion started by: mailkarthik
3 Replies

8. Shell Programming and Scripting

Find regex, place on individual lines and insert blank line before

Hello, I have a file that I want to be able to insert a new line before every instance of a regex. I can get it to do this for each line that contains the regex, but not for each instance. Contents of infile: Test this 1... Test this 2... Test this 3... Test this 4... Test this... (2 Replies)
Discussion started by: deneuve01
2 Replies

9. Shell Programming and Scripting

Need to pass value in sed command

Hi, I have a file a.xml containing the below <customerId>000</customerId> and a variable CUSTOMER_ID which is set to '333' Now I want to replace <customerId>000</customerId> with <customerId>333</customerId> by the below sed command and save the output in a file b.xml: sed... (3 Replies)
Discussion started by: RomitaaChawla@1
3 Replies

10. Shell Programming and Scripting

Need Help with a sed command involving Regex

Hi, Iam a newbie to SED. I'm faced with a problem as described. Given the file with text 1 rwerwerwe rere 2 fdfefefe fsdfds 3 rerere ffff trtrt 4 aaaa 1234 asadsdsd 5 hfjfjfjsjfsf... (14 Replies)
Discussion started by: SShinde
14 Replies
MAN(6)								   Games Manual 							    MAN(6)

NAME
man - macros to typeset manual SYNOPSIS
nroff -man file ... troff -man file ... DESCRIPTION
These macros are used to format pages of this manual. Except in and requests, any text argument denoted t in the request summary may be zero to six words. Quotes " ... " may be used to include blanks in a `word'. If t is empty, the special treatment is applied to the next text input line (the next line that doesn't begin with dot). In this way, for example, .I may be used to italicize a line of more than 6 words, or .SM followed by .B to make small letters in `bold' font. A prevailing indent distance is remembered between successive indented paragraphs, and is reset to default value upon reaching a non- indented paragraph. Default units for indents i are ens. The fonts are R roman, the main font, preferred for diagnostics I italic, preferred for parameters, short names of commands, names of manual pages, and naked function names `bold', actually the constant width font, preferred for examples, file names, declarations, keywords, names of struct members, and literals (numbers are rarely literals) L also the constant width font. In troff L=B; in nroff arguments of the macros .L, .LR, and .RL are printed in quotes; preferred only where quotes really help (e.g. lower-case literals and punctuation). Type font and size are reset to default values before each paragraph, and after processing font- or size-setting macros. The -man macros admit equations and tables in the style of eqn(1) and tbl(1), but do not support arguments on .EQ and .TS macros. These strings are predefined by -man: *R `(Reg)', trademark symbol in troff. *S Change to default type size. FILES
/sys/lib/tmac/tmac.an SEE ALSO
troff(1), man(1) REQUESTS
Request Cause If no Explanation Break Argument .B t no t=n.t.l.*Text t is `bold'. .BI t no t=n.t.l. Join words of t alternating bold and italic. .BR t no t=n.t.l. Join words of t alternating bold and Roman. .DT no Restore default tabs. .EE yes End displayed example .EX yes Begin displayed example .HP i yes i=p.i.* Set prevailing indent to i. Begin paragraph with hanging indent. .I t no t=n.t.l. Text t is italic. .IB t no t=n.t.l. Join words of t alternating italic and bold. .IP x i yes x="" Same as .TP with tag x. .IR t no t=n.t.l. Join words of t alternating italic and Roman. .L t no t=n.t.l. Text t is literal. .LP yes Same as .PP. .LR t no Join 2 words of t alternating literal and Roman. .PD d no d=.4v Interparagraph distance is d. .PP yes Begin paragraph. Set prevailing indent to default. .RE yes End of rel- ative indent. Set prevailing indent to amount of starting .RS. .RI t no t=n.t.l. Join words of t alternating Roman and italic. .RL t no Join 2 or 3 words of t alternating Roman and literal. .RS i yes i=p.i. Start relative indent, move left margin in distance i. Set prevailing indent to default for nested indents. .SH t yes t="" Subhead; reset paragraph distance. .SM t no t=n.t.l. Text t is small. .SS t no t="" Secondary subhead. .TF s yes Prevailing indent is wide as string s in font L; para- graph distance is 0. .TH n c x yes Begin page named n of chapter c; x is extra commentary, e.g. `local', for page head. Set prevailing indent and tabs to default. .TP i yes i=p.i. Set prevailing indent to i. Restore default indent if i=0. Begin indented paragraph with hanging tag given by next text line. If tag doesn't fit, place it on separate line. .1C yes Equalize columns and return to 1-column output .2C yes Start 2-column nofill output * n.t.l. = next text line; p.i. = prevailing indent BUGS
There's no way to fool troff into handling literal double quote marks " in font-alternation macros, such as There is no direct way to suppress column widows in 2-column output; the column lengths may be adjusted by inserting requests before the closing MAN(6)
All times are GMT -4. The time now is 12:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy