Sponsored Content
Top Forums Shell Programming and Scripting Using sed inside system call in awk Post 302977556 by RudiC on Tuesday 19th of July 2016 04:52:12 PM
Old 07-19-2016
@rbatte1: in my bash, my_dir="${my_dir%/:=/}" doesn't work. Is that a "bashism" or do I do sth. wrong?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

a system call for sed in a awk script

Hi, this is my test file : DELETE FROM TABLE WHERE ID_INTERNAL = :TABLE.ID-INTERNAL, ID-INTERNAL-CRAZY ID-INTERNAL-OPEN ID-INTERNAL /ID-INTERNAL/ I want all occurences of ID-INTERNAL replaced with a one, if ID-INTERNAL has and dash afer it , dont replace it example:... (6 Replies)
Discussion started by: seaten
6 Replies

2. UNIX for Advanced & Expert Users

how to differentiate system call from library call

Hi, Ho do I differentiate system call from library call? for example if I am using chmod , how do I find out if it is a system call or library call? Thanks Muru (2 Replies)
Discussion started by: muru
2 Replies

3. Shell Programming and Scripting

how to assign a value to several variables inside awk call

Hi I am using 'awk" to get file size and date of the file: op - sundev3 $ ls -l /bb/bin/tsfiles.sel | awk '{print $5 $6 $7}' 1587May8 May be somobody knows the way to combine this command with variable assignmet inside the awk, so I would have variables SIZE, MONTH and DATE assigned after... (1 Reply)
Discussion started by: aoussenko
1 Replies

4. Shell Programming and Scripting

Appending string (charachters inside the line) to a fixed width file using awk or sed

Source File: abcdefghijklmnop01qrstuvwxyz abcdefghijklmnop02qrstuvwxyz abcdefghijklmnop03qrstuvwxyz abcdefghijklmnop04qrstuvwxyz abcdefghijklmnop05qrstuvwxyz Whatever characters are in 17-18 on each line of the file, it should be concatenated to the same line at the character number... (6 Replies)
Discussion started by: tamahomekarasu
6 Replies

5. Shell Programming and Scripting

Passing argument to system call in awk script

So, I have this script. It reads a CSV file that has a mixture of object names with IP addresses (parsing out that part I have working), and object names which have a DNS name. I want to be able to run a "dig +short" based off of the name given to me in the line of the awk script, and then deal... (6 Replies)
Discussion started by: mikesimone
6 Replies

6. Shell Programming and Scripting

System call using awk on Solaris

I'm brand new to awk and need your help. I want to be able to shut down my workstations when they become to hot (because we've lost our cooling). I found a really neat way to monitor the temperature of the system and a short, simple awk scipt to use with it: /usr/sbin/prtpicl -v -c... (2 Replies)
Discussion started by: natural
2 Replies

7. Shell Programming and Scripting

Invoking system(cmd) inside awk command

Hi, I was searching for a way to grep 2 lines before and after a certain keyword, and I came across the following code.. awk "\$0 ~ /ORA-/ { cmd=\"awk 'NR>=\" NR-2 \" && NR<=\" NR+2 \"' init.ora\" system(cmd) }" input_file I could not understand how this works. What is system() ? what... (2 Replies)
Discussion started by: Kulasekar
2 Replies

8. UNIX for Dummies Questions & Answers

sed inside awk

What I want to do is delete everything upto the last underscore (_) in column 2. awk '{ $2=$(echo $2 | sed 's/.*_//'); print $0}' Sed works fine if I echo the string into it, this doesnt work inside awk. What am I doing wrong? Similarly, how do I store the substring starting with a... (4 Replies)
Discussion started by: senhia83
4 Replies

9. Shell Programming and Scripting

awk statement piped inside sed

Hello folks, I have multiple occurrences of the pattern: ).: where is any digit, in various text context but the pattern is unique as this regex. And I need to turn this decimal fraction into an integer (corresponding percent value: the range of 0-100). What I'm doing is: cat... (1 Reply)
Discussion started by: roussine
1 Replies

10. UNIX for Beginners Questions & Answers

sed inside the awk script to replace a string in the array

The requirement is i need to find an array value matching with pattern {5:{ , replace that with 5: and reassign that to same array index and print it. I write something like below and the issue is sed command is not working. If i replace " with "`" the script gives syntax error.how can i... (8 Replies)
Discussion started by: bhagya123
8 Replies
DBIx::ContextualFetch(3pm)				User Contributed Perl Documentation				DBIx::ContextualFetch(3pm)

NAME
DBIx::ContextualFetch - Add contextual fetches to DBI SYNOPSIS
my $dbh = DBI->connect(...., { RootClass => "DBIx::ContextualFetch" }); # Modified statement handle methods. my $rv = $sth->execute; my $rv = $sth->execute(@bind_values); my $rv = $sth->execute(@bind_values, @bind_cols); # In addition to the normal DBI sth methods... my $row_ref = $sth->fetch; my @row = $sth->fetch; my $row_ref = $sth->fetch_hash; my %row = $sth->fetch_hash; my $rows_ref = $sth->fetchall; my @rows = $sth->fetchall; my $rows_ref = $sth->fetchall_hash; my @tbl = $sth->fetchall_hash; DESCRIPTION
It always struck me odd that DBI didn't take much advantage of Perl's context sensitivity. DBIx::ContextualFetch redefines some of the various fetch methods to fix this oversight. It also adds a few new methods for convenience (though not necessarily efficiency). SET-UP my $dbh = DBIx::ContextualFetch->connect(@info); my $dbh = DBI->connect(@info, { RootClass => "DBIx::ContextualFetch" }); To use this method, you can either make sure that everywhere you normall call DBI->connect() you either call it on DBIx::ContextualFetch, or that you pass this as your RootClass. After this DBI will Do The Right Thing and pass all its calls through us. EXTENSIONS
execute $rv = $sth->execute; $rv = $sth->execute(@bind_values); $rv = $sth->execute(@bind_values, @bind_cols); execute() is enhanced slightly: If called with no arguments, or with a simple list, execute() operates normally. When when called with two array references, it performs the functions of bind_param, execute and bind_columns similar to the following: $sth->execute(@bind_values); $sth->bind_columns(undef, @bind_cols); In addition, execute will accept tainted @bind_values. I can't think of what a malicious user could do with a tainted bind value (in the general case. Your application may vary.) Thus a typical idiom would be: $sth->execute([$this, $that], [($foo, $bar)]); Of course, this method provides no way of passing bind attributes through to bind_param or bind_columns. If that is necessary, then you must perform the bind_param, execute, bind_col sequence yourself. fetch $row_ref = $sth->fetch; @row = $sth->fetch; A context sensitive version of fetch(). When in scalar context, it will act as fetchrow_arrayref. In list context it will use fetchrow_array. fetch_hash $row_ref = $sth->fetch_hash; %row = $sth->fetch_hash; A modification on fetchrow_hashref. When in scalar context, it acts just as fetchrow_hashref() does. In list context it returns the complete hash. fetchall $rows_ref = $sth->fetchall; @rows = $sth->fetchall; A modification on fetchall_arrayref. In scalar context it acts as fetchall_arrayref. In list it returns an array of references to rows fetched. fetchall_hash $rows_ref = $sth->fetchall_hash; @rows = $sth->fetchall_hash; A mating of fetchall_arrayref() with fetchrow_hashref(). It gets all rows from the hash, each as hash references. In scalar context it returns a reference to an array of hash references. In list context it returns a list of hash references. ORIGINAL AUTHOR
Michael G Schwern as part of Ima::DBI CURRENT MAINTAINER
Tony Bowden <tony@tmtm.com> LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
DBI. Ima::DBI. Class::DBI. perl v5.10.0 2005-09-27 DBIx::ContextualFetch(3pm)
All times are GMT -4. The time now is 07:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy