Sponsored Content
Top Forums Shell Programming and Scripting KSH Output/Strip portion of file in HP-UX Post 302359917 by Scott on Wednesday 7th of October 2009 05:21:59 PM
Old 10-07-2009
Hi.

$C was to show how shell variable could be used inside the awk (for example if it was an argument to the script:

Code:
C=${1:-Point-A}

etc.

It could have been done in other ways

Code:
/Point-A/ { ... }

Code:
awk '
...
'  C=Point-A

(and then refer to it as C instead of $C)
Code:
awk -v C=Point-A '
...
' ...

Matching "BEGIN" isn't enough anyway, as there are many BEGINs, but hopefully only one Point-A.

P makes it work because when P is true (i.e. 1) the default action (print) is executed. P is set when $C is matched.

Hoi, Scrutinizer, there is absolutely nothing wrong with the good ol' shell script! AWK is just faster if you have a fair amount of data.

Last edited by Scott; 10-07-2009 at 06:34 PM.. Reason: spelling mistakes galoore
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to strip apostrophe from a file

I am trying to remove or replace various extraneous characters from a file so that subsequent processes work correctly. The characters that is giving me trouble is the apostrophe '. The command I 'm trying is sed 's/\'//g' ${IN_WRK_DIR}/file1 > ${IN_WRK_DIR}/file2 in a Korn script on HP... (8 Replies)
Discussion started by: aquimby
8 Replies

2. Shell Programming and Scripting

How to Strip lines off Streamed EDI Output

Attached is a streamed EDI ANSI X12 output where the segment terminator/delimiter is a tilde ~ character. Is it possible to do the following pseudo-code in a unix script (using either sed, awk and/or grep)? Open file StreamedOutput.txt Search for ISA and delete the data up to the tilde ~ char... (7 Replies)
Discussion started by: sapedi
7 Replies

3. Shell Programming and Scripting

printing portion of the output usind sed/awk

friends, i am a newbie in scripting. could someone help me in selecting only the last column of below ps command output ? mqm 14 16466 0 Sep 15 ? 0:01 /opt/mqm/bin/runmqlsr -r -m QMGR.INBOUNDSSL -t TCP -p 1415 -i 5.1.26.5 mqm 12 16700 0 Sep 15 ? 0:00... (4 Replies)
Discussion started by: unahb1
4 Replies

4. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

5. UNIX for Dummies Questions & Answers

Grab Portion of Output Text (sed, grep, awk?)

Alright, here's the deal. I'm running the following ruby script (output follows): >> /Users/name/bin/acweather.rb -z 54321 -o /Users/name/bin -c Clouds AND Sun 57/33 - Mostly sunny and cool I want to just grab the "57/33" portion, but that's it. I don't want any other portion of the line. I... (5 Replies)
Discussion started by: compulsiveguile
5 Replies

6. Shell Programming and Scripting

strip csv file

Hi everyone, I hope someone can help me: i am trying to get some info from a csv file, after i awk the column i need , i made a selection and output it in a file. now i need to get a list from this file, but i stuck with some fields. basically i have a text file with next data: 3... (3 Replies)
Discussion started by: lostym
3 Replies

7. Shell Programming and Scripting

ksh using input file with output going to same file name and location

I've been asked if I can write a "quick" little ksh script that will do the following: java java_class_file /dir/input_file.xml /dir/output_file.xml I'm a complete newbie with ksh so any help would be appreciated. This is on AIX and java is found in /usr/java5/jre/bin/java (4 Replies)
Discussion started by: newbie_ksh
4 Replies

8. UNIX for Dummies Questions & Answers

Strip out number from wc output?

I am trying to output two command substitutions echo "$(command) $(command)" with a single echo however when using wc -l within the second substitution, that substitution, instead of appearing in order at the end of the line output, it overwrites the beginning of the output line. I've tried... (2 Replies)
Discussion started by: somegeek
2 Replies

9. Shell Programming and Scripting

ksh - Read input from file and output CSV i same row

Hello I have the following output and want the output to look: FROM: GigabitEthernet0/0 is up, line protocol is up 1 input errors, 0 CRC, 0 frame, 1 overrun, 0 ignored 275 output errors, 0 collisions, 3 interface resets GigabitEthernet0/1 is up, line protocol is up 0... (4 Replies)
Discussion started by: JayJay2018
4 Replies
Mojo::Parameters(3pm)					User Contributed Perl Documentation				     Mojo::Parameters(3pm)

NAME
Mojo::Parameters - Parameter container SYNOPSIS
use Mojo::Parameters; my $p = Mojo::Parameters->new(foo => 'bar', baz => 23); DESCRIPTION
Mojo::Parameters is a container for form parameters. ATTRIBUTES
Mojo::Parameters implements the following attributes. "charset" my $charset = $p->charset; $p = $p->charset('UTF-8'); Charset used for decoding parameters, defaults to "UTF-8". "pair_separator" my $separator = $p->pair_separator; $p = $p->pair_separator(';'); Separator for parameter pairs, defaults to "&". METHODS
Mojo::Parameters inherits all methods from Mojo::Base and implements the following new ones. "new" my $p = Mojo::Parameters->new; my $p = Mojo::Parameters->new('foo=b%3Bar&baz=23'); my $p = Mojo::Parameters->new(foo => 'b;ar'); my $p = Mojo::Parameters->new(foo => ['ba;r', 'b;az']); my $p = Mojo::Parameters->new(foo => ['ba;r', 'b;az'], bar => 23); Construct a new Mojo::Parameters object. "append" $p = $p->append(foo => 'ba;r'); $p = $p->append(foo => ['ba;r', 'b;az']); $p = $p->append(foo => ['ba;r', 'b;az'], bar => 23); Append parameters. # "foo=bar&foo=baz" Mojo::Parameters->new('foo=bar')->append(foo => 'baz'); # "foo=bar&foo=baz&foo=yada" Mojo::Parameters->new('foo=bar')->append(foo => ['baz', 'yada']); # "foo=bar&foo=baz&foo=yada&bar=23" Mojo::Parameters->new('foo=bar')->append(foo => ['baz', 'yada'], bar => 23); "clone" my $p2 = $p->clone; Clone parameters. "merge" $p = $p->merge(Mojo::Parameters->new(foo => 'b;ar', baz => 23)); Merge parameters. "param" my @names = $p->param; my $foo = $p->param('foo'); my @foo = $p->param('foo'); my $foo = $p->param(foo => 'ba;r'); my @foo = $p->param(foo => qw(ba;r ba;z)); Check and replace parameter values. "params" my $params = $p->params; $p = $p->params([foo => 'b;ar', baz => 23]); Parsed parameters. "parse" $p = $p->parse('foo=b%3Bar&baz=23'); Parse parameters. "remove" $p = $p->remove('foo'); Remove parameters. # "bar=yada" Mojo::Parameters->new('foo=bar&foo=baz&bar=yada')->remove('foo'); "to_hash" my $hash = $p->to_hash; Turn parameters into a hash reference. # "baz" Mojo::Parameters->new('foo=bar&foo=baz')->to_hash->{foo}[1]; "to_string" my $string = $p->to_string; Turn parameters into a string. SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 Mojo::Parameters(3pm)
All times are GMT -4. The time now is 07:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy