Sponsored Content
Full Discussion: awk - change variable on fly
Top Forums UNIX for Dummies Questions & Answers awk - change variable on fly Post 302627413 by Scrutinizer on Friday 20th of April 2012 02:18:21 PM
Old 04-20-2012
OK, and when you paste this on the command line?
Code:
awk  -F '^"|","|"$' -v start=1334872800 '{"date +%s -d \"" $10 "\"" | getline current} current < start {print $10 " "current " " start}' lol.tmp

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to change awk and shell variable value?

In awk script, #!/bin/sh awk 'BEGIN{i=0;}{i=i+5;}END{print i}' in.txt vr=0; vr=$i; echo "$vr" How can i assign that value of i in $vr(variable) of shell script? (7 Replies)
Discussion started by: cola
7 Replies

2. Shell Programming and Scripting

Change only the name of a variable

if I have a variable named z inside a java file, is there any way to globally change the name of the variable and all its occurences as a variable? (but not any other z that is not part of that variable name) (3 Replies)
Discussion started by: lydiaflamp
3 Replies

3. Shell Programming and Scripting

awk: change string variable

Hi. How to change string variable in awk? for example, I parse with awk script text file named some_name_with_extension.txt I want to print only some_name in my script .... varCompName = FILENAME print varCompName How to put not all symbols from FILENAME to variable? thank you This... (4 Replies)
Discussion started by: cintlt
4 Replies

4. Shell Programming and Scripting

Store Host lookup in variable ("on the fly")

Hi, I'm new here. I was wondering why I can't store a host lookup in a variable. for line in $(< blacklist) do STOREIP=host $line; if ]; then $line >> blacklist2; else $line >> blacklist3; fi done Result: "ip" command not found .. so how would I store the host lookup in the... (2 Replies)
Discussion started by: sOliver
2 Replies

5. Shell Programming and Scripting

using awk for setting variable but change the output of this variable within awk

Hi all, Hope someone can help me out here. I have this BASH script (see below) My problem lies with the variable path. The output of the command find will give me several fields. The 9th field is the path. I want to captured that and the I want to filter this to a specific level. The... (6 Replies)
Discussion started by: Cowardly
6 Replies

6. Shell Programming and Scripting

Change the filename variable value

Hi guys, I have a variable where i am storing the filename (with full path). I just need the value before ".txt". But instead of getting the filename i am getting the contents of the filename. FileName=/appl/data/Input/US/Test.txt a=`awk -F"." '{print $1}' ${FileName}` echo $a... (3 Replies)
Discussion started by: mac4rfree
3 Replies

7. Shell Programming and Scripting

Change Variable Value from Multiple Scripts and Use these Variable

Hi to All, Please find below details. file_config.config export file1_status="SUCCESS" export file2_status="SUCCESS" file_one.sh I am calling another two shell script from these script. I need to pass individual two script status (If it's "FAILED") to file_main.sh. file_main.sh I... (2 Replies)
Discussion started by: div_Neev
2 Replies

8. Shell Programming and Scripting

I can't change the value of my variable!

I made this HEADMAKER variable to pull the header from the first file in the loop, but then to stop so it doesn't override the file with later loops. However, I CANNOT get it to reassign the value of my variable away from "FIRST". I have also tried it with 1 and 0, and with and without quotes and... (3 Replies)
Discussion started by: crankymonkey
3 Replies

9. UNIX for Dummies Questions & Answers

Change variable value

I have big XML which i want to change all VERSIONNUMBER equal to 1,in existing file values of VERSIONNUMBER will be different as below now i want to change all VERSIONNUMBER values qual to 1.Please help me which will convert versionnumber values. <SHORTCUT OBJECTSUBTYPE ="" OBJECTTYPE ... (5 Replies)
Discussion started by: katakamvivek
5 Replies

10. Shell Programming and Scripting

Make change to variable value inside of awk script

Hello, I have text data that looks like this, Mrv16a3102061815532D 6 6 0 0 0 0 999 V2000 -0.4018 1.9634 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 -1.1163 1.5509 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 -1.1163 0.7259 ... (9 Replies)
Discussion started by: LMHmedchem
9 Replies
Mail::Message::Body::Construct(3pm)			User Contributed Perl Documentation		       Mail::Message::Body::Construct(3pm)

NAME
Mail::Message::Body::Construct - adds functionality to Mail::Message::Body DESCRIPTION
This package adds complex functionality to the Mail::Message::Body class. This functions less often used, so many programs will not compile this package. METHODS
Constructing a body $obj->attach(MESSAGES, OPTIONS) Make a multipart containing this body and the specified MESSAGES. The options are passed to the constructor of the multi-part body. If you need more control, create the multi-part body yourself. At least take a look at Mail::Message::Body::Multipart. The message-parts will be coerced into a Mail::Message::Part, so you may attach Mail::Internet or MIME::Entity objects if you want --see Mail::Message::coerce(). A new body with attached messages is returned. example: my $pgpkey = Mail::Message::Body::File->new(file => 'a.pgp'); my $msg = Mail::Message->buildFromBody( $message->decoded->attach($pgpkey)); # The last message of the $multi multiparted body becomes a coerced $entity. my $entity = MIME::Entity->new; my $multi = $msg->body->attach($entity); # Now create a new message my $msg = Mail::Message->new(head => ..., body => $multi); $obj->concatenate(COMPONENTS) Concatenate a list of elements into one new body. Specify a list of text COMPONENTS. Each component can be a message (Mail::Message, the body of the message is used), a plain body (Mail::Message::Body), "undef" (which will be skipped), a scalar (which is split into lines), or an array of scalars (each providing one line). example: # all arguments are Mail::Message::Body's. my $sum = $body->concatenate($preamble, $body, $epilogue, "-- " , $sig); $obj->foreachLine(CODE) Create a new body by performing an action on each of its lines. If none of the lines change, the current body will be returned, otherwise a new body is created of the same type as the current. The CODE refers to a subroutine which is called, where $_ contains body's original line. DO NOT CHANGE $_!!! The result of the routine is taken as new line. When the routine returns "undef", the line will be skipped. example: my $content = $msg->decoded; my $reply = $content->foreachLine( sub { '> '.$_ } ); my $rev = $content->foreachLine( sub {reverse} ); sub filled() { length $_ > 1 ? $_ : undef } my $nonempty = $content->foreachLine( &filled ); my $wrong = $content->foreachLine( sub {s/a/A/} ); # WRONG!!! my $right = $content->foreachLine( sub {(my $x=$_) =~ s/a/A/; $x} ); $obj->stripSignature(OPTIONS) Strip the signature from the body. The body must already be decoded otherwise the wrong lines may get stripped. Returned is the stripped version body, and in list context also the signature, encapsulated in its own body object. The signature separator is the first line of the returned signature body. The signature is added by the sender to tell about him- or herself. It is superfluous in some situations, for instance if you want to create a reply to the person's message you do not need to include that signature. If the body had no signature, the original body object is returned, and "undef" for the signature body. -Option --Default max_lines 10 pattern qr/^--s?$/ result_type <same as current> max_lines => INTEGER|undef The maximum number of lines which can be the length of a signature. Specify "undef" to remove the limit. pattern => REGEX|STRING|CODE Which pattern defines the line which indicates the separator between the message and the signature. In case of a STRING, this is matched to the beginning of the line, and REGEX is a full regular expression. In case of CODE, each line (from last to front) is passed to the specified subroutine as first argument. The subroutine must return TRUE when the separator is found. result_type => CLASS The type of body to be created for the stripped body (and maybe also to contain the stripped signature) example: my $start = $message->decoded; my $start = $body->decoded; my $stripped = $start->stripSignature; my ($stripped, $sign) = $start->stripSignature (max_lines => 5, pattern => '-*-*-'); SEE ALSO
This module is part of Mail-Box distribution version 2.105, built on May 07, 2012. Website: http://perl.overmeer.net/mailbox/ LICENSE
Copyrights 2001-2012 by [Mark Overmeer]. For other contributors see ChangeLog. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html perl v5.14.2 2012-05-07 Mail::Message::Body::Construct(3pm)
All times are GMT -4. The time now is 03:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy