Sponsored Content
Top Forums Shell Programming and Scripting Parse variable length status,timestamp CSV Post 302602556 by KarmaPoliceT2 on Monday 27th of February 2012 05:27:32 PM
Old 02-27-2012
Parse variable length status,timestamp CSV

I have the output of a process which on status change of the object being processed appends status,timestamp to the record in the text file...

so i end up with output something like:

Code:
 
task123,TERMINAL,glob,5,INITIAL,2012-02-27 16:48:07,PREPARING,2012-02-27 16:49:06,SCHEDULED,2012-02-27 16:49:06,TRANSLATING,2012-02-27 16:49:07,TERMINAL,2012-02-27 16:50:52
task345,COMPLETE,glob2,6,INITIAL,2012-02-27 16:48:07,PREPARING,2012-02-27 16:49:06,SCHEDULED,2012-02-27 16:49:07,TRANSLATING,2012-02-27 16:49:22,LOADING,2012-02-27 16:50:53,COMPLETE,2012-02-27 16:50:53

what i'd like to do is parse this into a set of variables for a given job (i'll end up looping through the file record by record)...

what i'm not sure is how to get the value after a matched string and save it in a variable...

so for example i want to save the timestamp following "PREPARING" into a variable called v_PREPARING

and i want to iterate through the line to get all of these values... the good thing i guess (though not sure how its helpful) is that the value after glob/glob2 is a count of the number of status' on that line...

thoughts?
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

creating a fixed length output from a variable length input

Is there a command that sets a variable length? I have a input of a variable length field but my output for that field needs to be set to 32 char. Is there such a command? I am on a sun box running ksh Thanks (2 Replies)
Discussion started by: r1500
2 Replies

2. Shell Programming and Scripting

use awk to read variable length csv

Any help to read the contents of a variable length csv ....??(using awk) The csv mite look like this : anjali,ram,rahul,mohini,sam,.... and so on ... I need to pick up each name.. Thanks in advance SD (3 Replies)
Discussion started by: shweta_d
3 Replies

3. UNIX for Dummies Questions & Answers

Convert a tab delimited/variable length file to fixed length file

Hi, all. I need to convert a file tab delimited/variable length file in AIX to a fixed lenght file delimited by spaces. This is the input file: 10200002<tab>US$ COM<tab>16/12/2008<tab>2,3775<tab>2,3783 19300978<tab>EURO<tab>16/12/2008<tab>3,28523<tab>3,28657 And this is the expected... (2 Replies)
Discussion started by: Everton_Silveir
2 Replies

4. Shell Programming and Scripting

Parse a line which has different word length

Hi All, Please let me know a command to parse the below line and find the words, I have a line like this 40609 39930 In this above line the two words are separted by space.The length of this two words may differ. I want to put 40609 in var_one and 39930 in var_two. Eg. Input line is ... (1 Reply)
Discussion started by: girish.raos
1 Replies

5. Shell Programming and Scripting

Make variable length record a fixed length

Very, very new to unix scripting and have a unique situation. I have a file of records that contain 3 records types: (H)eader Records (D)etail Records (T)railer Records The Detail records are 82 bytes in length which is perfect. The Header and Trailer records sometimes are 82 bytes in... (3 Replies)
Discussion started by: jclanc8
3 Replies

6. Shell Programming and Scripting

Split variable length and variable format CSV file

Dear all, I have basic knowledge of Unix script and her I am trying to process variable length and variable format CSV file. The file length will depend on the numbers of Earnings/Deductions/Direct Deposits. And The format will depend on whether it is Earnings/Deductions or Direct Deposits... (2 Replies)
Discussion started by: chechun
2 Replies

7. Shell Programming and Scripting

changing a variable length text to a fixed length

Hi, Can anyone help with a effective solution ? I need to change a variable length text field (between 1 - 18 characters) to a fixed length text of 18 characters with the unused portion, at the end, filled with spaces. The text field is actually field 10 of a .csv file however I could cut... (7 Replies)
Discussion started by: dc18
7 Replies

8. Shell Programming and Scripting

Check/Parse log file's lines using time difference/timestamp

I was looking at this script which outputs the two lines which differs less than one sec. #!/usr/bin/perl -w use strict; use warnings; use Time::Local; use constant SEC_MILIC => 1000; my $file='infile'; ## Open for reading argument file. open my $fh, "<", $file or die "Cannot... (1 Reply)
Discussion started by: cele_82
1 Replies

9. Shell Programming and Scripting

Convert variable length record to fixed length

Hi Team, I have an issue to split the file which is having special chracter(German Char) using awk command. I have a different length records in a file. I am separating the files based on the length using awk command. The command is working fine if the record is not having any... (7 Replies)
Discussion started by: Anthuvan
7 Replies
GEARADMIN(1)							     Gearmand							      GEARADMIN(1)

NAME
gearadmin - Gearmand Documentation, http://gearman.info/ Run Administrative commands against a server. SYNOPSIS
--help Provice help about the program. --create-function Create a function from the server. -h [ --host ] arg (=localhost)i Connect to the host -p [ --port ] arg (=4730) Port number or service to use for connection --drop-function Drop a function from the server. --server-version Fetch the version number for the server. --server-verbose Fetch the verbose setting for the server. --status Status for the server. --workers Workers for the server. --shutdown Shutdown server. DESCRIPTION
Command line tool for manipulating gearmand servers. HOME
To find out more information please check: http://gearman.info/ SEE ALSO
gearmand(8) libgearman(3) AUTHOR
Data Differential http://www.datadifferential.com/ COPYRIGHT
2012, Data Differential, http://www.datadifferential.com/ 0.33 May 04, 2012 GEARADMIN(1)
All times are GMT -4. The time now is 04:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy