Sponsored Content
Full Discussion: awk - change variable on fly
Top Forums UNIX for Dummies Questions & Answers awk - change variable on fly Post 302627269 by haczyk on Friday 20th of April 2012 11:26:36 AM
Old 04-20-2012
Hello,

I have defenied separator for this in letsgo.cfg file. Currently I pushed all stuff to one file:

Code:
# grep -v ^# letsgo.sh
DataStart="2012/01/01"
DateEnd="2012/04/15"
start=`date +%s -d "$DateStart"`
end=`date +%s -d "$DateEnd"`
awk  -F '^"|","|"$' -v start="$start" '{"date +%s -d \"2008/12/20 00:00:00\"" | getline current} current < start {print $10 " "current " " start}' lol.tmp
#

lol.tmp contain 10 example lines from my basic file (~40MB ;/ )

About $10:
# awk -F '^"|","|"$' '{ print $10 }' lol.tmp
2012/02/22 00:00:00
2012/02/09 00:00:00
2012/01/05 00:00:00
2012/02/22 00:00:00
2012/03/01 00:00:00
2011/12/12 00:00:00
2011/12/12 00:00:00
2011/02/23 00:00:00
2011/03/24 00:00:00
2011/04/05 00:00:00
#

So why this wont work:
Code:
awk  -F '^"|","|"$' -v start="$start" '{"date +%s -d \""$10"\"" | getline current} current < start {print $10 " "current " " start}' lol.tmp

?

I will be grateful for any tips.
 

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
INDEX_DUMP(1p)						User Contributed Perl Documentation					    INDEX_DUMP(1p)

NAME
index_dump - Show the content of the index file FORMAT
index_dump [options] file [ tag ] where options are --debug set debug level --type specifies the num/date/char type of the index --start defines the value to start dump from --n prints also the total number of records in the file SYNOPSIS
index_dump rooms.cdx FACILITY index_dump --debug=14 --start=Dub rooms.cdx ROOMNAME DESCRIPTION
Index_dump prints to standard output the content of the index file. The type of the index is one of those supported by the XBase::Index Perl module (cdx, idx, ntx, ndx, mdx). The output contains the index key and the value, which is the record number in the correcponding dbf file. For mulitag index files (like cdx), you need to specify the tag name to get the actual data. AVAILABLE FROM
http://www.adelton.com/perl/DBD-XBase/ AUTHOR
(c) 1999--2011 Jan Pazdziora. SEE ALSO
perl(1); XBase::Index(3pm); dbf_dump(1p) perl v5.12.4 2011-08-31 INDEX_DUMP(1p)
All times are GMT -4. The time now is 09:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy