Sponsored Content
Full Discussion: Command line - awk, sed
Top Forums Shell Programming and Scripting Command line - awk, sed Post 302800399 by hanson44 on Monday 29th of April 2013 04:07:32 PM
Old 04-29-2013
Code:
$ cat file
CTRY=GM&PROJTYPE=SP&PROJECTTYPE=Small+Project

Code:
$ cat test.sh
pattern=$1
sed "s/.*\<$pattern\>=\([^&]*\)&*.*/\1/" file | tr "+" " "

Code:
$ ./test.sh PROJECTTYPE
Small Project

This User Gave Thanks to hanson44 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read logline line by line with awk/sed

Hello, I have a logfile which is in this format: 1211667249500#3265 1211667266687#2875 1211667270781#1828 Is there a way to read the logfile line by line every time I execute the code and put the two numbers in the line in two separate variables? Something like: 1211667249500#3265... (7 Replies)
Discussion started by: dejavu88
7 Replies

2. Shell Programming and Scripting

awk/sed Command : Parse parameter file / send the lines to the ksh export command

Sorry for the duplicate thread this one is similar to the one in https://www.unix.com/shell-programming-scripting/88132-awk-sed-script-read-values-parameter-files.html#post302255121 Since there were no responses on the parent thread since it got resolved partially i thought to open the new... (4 Replies)
Discussion started by: rajan_san
4 Replies

3. Shell Programming and Scripting

awk;sed appending line to previous line....

I know this has been asked before but I just can't parse the syntax as explained. I have a set of files that has user information spread out over two lines that I wish to merge into one: User1NameLast User1NameFirst User1Address E-Mail:User1email User2NameLast User2NameFirst User2Address... (11 Replies)
Discussion started by: walkerwheeler
11 Replies

4. Shell Programming and Scripting

Need help in sed command [ printing a pattern + its line no or line no alone ]

Hello friends, Only very recently i started learning sed command...an i found that sed is faster in finding the patterns than some of my scripts that uses grep to check the patten inside a file using line by line search method which is time consuming. The below script... (4 Replies)
Discussion started by: frozensmilz
4 Replies

5. Shell Programming and Scripting

Loop with sed command to replace line with sed command in it

Okay, title is kind of confusion, but basically, I have a lot of scripts on a server that I need to replace a ps command, however, the new ps command I'm trying to replace the current one with pipes to sed at one point. So now I am attempting to create another script that replaces that line. ... (1 Reply)
Discussion started by: cbo0485
1 Replies

6. Shell Programming and Scripting

sed command to replace a line at a specific line number with some other line

my requirement is, consider a file output cat output blah sdjfhjkd jsdfhjksdh sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf hellow there this doesnt look good et cetc etc etcetera i want to replace a line of line number 4 ("this doesnt look good") with some other line ... (3 Replies)
Discussion started by: vivek d r
3 Replies

7. Shell Programming and Scripting

sed command to grep multiple pattern present in single line and delete that line

here is what i want to achieve.. i have a file with below contents cat fileName blah blah blah . .DROP this REJECT that . --sport 7800 -j REJECT --reject-with icmp-port-unreachable --dport 7800 -j REJECT --reject-with icmp-port-unreachable . . . more blah blah blah --dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies

8. Shell Programming and Scripting

sed and awk giving error ./sample.sh: line 13: sed: command not found

Hi, I am running a script sample.sh in bash environment .In the script i am using sed and awk commands which when executed individually from terminal they are getting executed normally but when i give these sed and awk commands in the script it is giving the below errors :- ./sample.sh: line... (12 Replies)
Discussion started by: satishmallidi
12 Replies

9. Shell Programming and Scripting

Multiple line search, replace second line, using awk or sed

All, I appreciate any help you can offer here as this is well beyond my grasp of awk/sed... I have an input file similar to: &LOG &LOG Part: "@DB/TC10000021855/--F" &LOG &LOG &LOG Part: "@DB/TC10000021852/--F" &LOG Cloning_Action: RETAIN &LOG Part: "@DB/TCCP000010713/--A" &LOG &LOG... (5 Replies)
Discussion started by: KarmaPoliceT2
5 Replies

10. Shell Programming and Scripting

sed command to replace a line in a file using line number from the output of a pipe.

Sed command to replace a line in a file using line number from the output of a pipe. Is it possible to replace a whole line piped from someother command into a file at paritcular line... here is some basic execution flow.. the line number is 412 lineNo=412 Now i have a line... (1 Reply)
Discussion started by: vivek d r
1 Replies
DJSCRIPT(1)							   Debian Linux 						       DJSCRIPT(1)

NAME
djscript - A text formatter for the HP DeskJet printer. SYNOPSIS
djscript [Options][<fil>...] DESCRIPTION
The tool's purpose is to make better use of the HP DeskJet's text modes. On one hand djscript enables the user to easily choose the differ- ent text modes of the DeskJet. On the other hand there are some add-ons supposed to make some if these modes really useful. djscript now uses the libpaper library to handle the paper name. OPTIONS
-F<font> Select font: `courier', `cgtimes', `lettgoth' (default: `courier') -P<prfil> Print to file <prfil> (default: -'). If <prfil> equals `-', standard output is taken. If <prfil> equals `:<cmd>', output is piped into <cmd> -S<size> Select paper size: `dina4', `legal', `letter' (default is libpaper default) -C<charset> Select character set: `ascii', `ansi', `ecma', `pc8', `pc850', `hpr8', `hpl' (default: `ascii') -lq Letter Quality instead of Draft. -itl Italics font. -nrw Narrow printing. `horizontal double density' (ignored with font `cgtimes') -low Low font. `vertical double density' -sml Small font, the same as narrow and low. -ls Landscape orientation instead of portrait. (works only with font `courier normal') -lph<n> Set the logical page height to <n> lines. -c[nw]<n> Produce multi column output of <n> text columns (n) or columns of <n> characters width each (w). -7966 Logical pages of 66 lines and 79 columns each. -m[lrtb]<n> set left/right/top/bottom margin to column/row <n>. -sf[hv]<x> Horizontal and vertical spacing factors. -pr<pgs> Print pages in page range specification <pgs> only. <pgs> is a comma separated list of expressions of the form i, -i, i-j, or i- where i and j denote logical page numbers. -il Ignore Ctrl-L characters. -pp Start each file on a new physical page. -sp Separate logical pages by horizontal and vertical bars. -sg Show the page geometry; do not print. -q Be quiet. -wc Show nonwarranty and copying info. -h Show help info. SEE ALSO
paperconf(1), papersize(5), paperconfig(8). AUTHOR
This manual page was written by Craig Small <csmall@debian.org>, for the Debian GNU/Linux system (but may be used by others). Debian Project June 1996 DJSCRIPT(1)
All times are GMT -4. The time now is 05:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy