Sponsored Content
Top Forums Shell Programming and Scripting Create csv from four disparate files Post 303035133 by RudiC on Wednesday 15th of May 2019 03:49:32 AM
Old 05-15-2019
How about
Code:
IFS=. read H REST <<EOF
$(echo *.out)
EOF
echo "host,accounts,max,pwd,standard"; echo $H | paste -d, - *.out
host,accounts,max,pwd,standard
host1,root,9,abc pwd=,standard:
,user1,,,        user = true
,user2,,,        expires = 0
,,,,        core_path = on
,,,,        default_roles =

Pipe result through sed 's/, \+/,/' to get rid of the residual spaces from *standard*.out.
This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare two csv files by two colums and create third file combining data from them.

I've got two large csv text table files with different number of columns each. I have to compare them based on first two columns and create resulting file that would in case of matched first two columns include all values from first one and all values (except first two colums) from second one. I... (5 Replies)
Discussion started by: agb2008
5 Replies

2. Shell Programming and Scripting

Merging files to create CSV file

Hi, I have different files of the same type, as: Time: 100 snr: 88 perf: 10 other: 222 Each of these files are created periodically. What I need to do is to merge all of them into one but having the following form: (2 Replies)
Discussion started by: Ravendark
2 Replies

3. Shell Programming and Scripting

How to create a CSV File by reading fields from separate files

SHELL SCRIPT Hi, I have 3 separate files within a folder. Every File contains data in a single column like File1 contains data mayank sushant dheeraj File2 contains DSA_AT MG_AT FLAT_09 File3 contains data 123123 232323 (2 Replies)
Discussion started by: mayanksargoch
2 Replies

4. Shell Programming and Scripting

Merge CSV files and create a column with the filename from the original file

Hello everyone!! I am not completely new to shell script but I havent been able to find the answer to my problem and I'm sure there are some smart brains here up for the challenge :D. I have several CSV files that I need to combine into one, but I also need to know where each row came from.... (7 Replies)
Discussion started by: fransanchezoria
7 Replies

5. UNIX for Dummies Questions & Answers

How to create a .csv file from 2 different .txt files?

Hi, I need to create a .csv file from information that i have in two different tab delimited .txt file. I just want to select some of the columns of each .txt file and paste them into a .cvs file. My files look like: File 1 transcript_id Seq. Description Seq. Length ... (2 Replies)
Discussion started by: alisrpp
2 Replies

6. Shell Programming and Scripting

Comparing Select Columns from two CSV files in UNIX and create a third file based on comparision

Hi , I want to compare first 3 columns of File A and File B and create a new file File C which will have all rows from File B and will include rows that are present in File A and not in File B based on First 3 column comparison. Thanks in advance for your help. File A A,B,C,45,46... (2 Replies)
Discussion started by: ady_koolz
2 Replies

7. Shell Programming and Scripting

How to create or convert to pdf files from csv files using shell script?

Hi, Can anyone help me how to convert a .csv file to a .pdf file using shell script Thanks (2 Replies)
Discussion started by: ssk250
2 Replies

8. Shell Programming and Scripting

Match columns from two csv files and update field in one of the csv file

Hi, I have a file of csv data, which looks like this: file1: 1AA,LGV_PONCEY_LES_ATHEE,1,\N,1,00020460E1,0,\N,\N,\N,\N,2,00.22335321,0.00466628 2BB,LES_POUGES_ASF,\N,200,200,00006298G1,0,\N,\N,\N,\N,1,00.30887539,0.00050312... (10 Replies)
Discussion started by: djoseph
10 Replies

9. Shell Programming and Scripting

Compare 2 files of csv file and match column data and create a new csv file of them

Hi, I am newbie in shell script. I need your help to solve my problem. Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file. File1: SourceFile,DateTimeOriginal /home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07... (8 Replies)
Discussion started by: refrain
8 Replies

10. Shell Programming and Scripting

Matching two fields in two csv files, create new file and append match

I am trying to parse two csv files and make a match in one column then print the entire file to a new file and append an additional column that gives description from the match to the new file. If a match is not made, I would like to add "NA" to the end of the file Command that Ive been using... (6 Replies)
Discussion started by: dis0wned
6 Replies
RT::Client::REST::Object(3pm)				User Contributed Perl Documentation			     RT::Client::REST::Object(3pm)

NAME
RT::Client::REST::Object -- base class for RT objects. SYNOPSIS
# Create a new type package RT::Client::REST::MyType; use base qw(RT::Client::REST::Object); sub _attributes {{ myattribute => { validation => { type => SCALAR, }, }, }} sub rt_type { "mytype" } 1; DESCRIPTION
The RT::Client::REST::Object module is a superclass providing a whole bunch of class and object methods in order to streamline the development of RT's REST client interface. ATTRIBUTES
Attributes are defined by method "_attributes" that should be defined in your class. This method returns a reference to a hash whose keys are the attributes. The values of the hash are attribute settings, which are as follows: list If set to true, this is a list attribute. See "LIST ATTRIBUTE PROPERTIES" below. validation A hash reference. This is passed to validation routines when associated mutator is called. See Params::Validate for reference. rest_name This specifies this attribute's REST name. For example, attribute "final_priority" corresponds to RT REST's "FinalPriority". This option may be omitted if the two only differ in first letter capitalization. form2value Convert form value (one that comes from the server) into attribute-digestible format. value2form Convert value into REST form format. Example: sub _attributes {{ id => { validation => { type => SCALAR, regex => qr/^d+$/, }, form2value => sub { shift =~ m~^ticket/(d+)$~i; return $1; }, value2form => sub { return 'ticket/' . shift; }, }, admin_cc => { validation => { type => ARRAYREF, }, list => 1, rest_name => 'AdminCc', }, }} LIST ATTRIBUTE PROPERTIES
List attributes have the following properties: o When called as accessors, return a list of items o When called as mutators, only accept an array reference o Convenience methods "add_attr" and "delete_attr" are available. For example: # Get the list my @requestors = $ticket->requestors; # Replace with a new list $ticket->requestors( [qw(dude@localhost)] ); # Add some random guys to the current list $ticket->add_requestors('randomguy@localhost', 'evil@local'); SPECIAL ATTRIBUTES
id and parent_id are special attributes. They are used by various DB-related methods and are especially relied upon by autostore, autosync, and autoget features. METHODS
new Constructor _generate_methods This class method generates accessors and mutators based on _attributes method which your class should provide. For items that are lists, 'add_' and 'delete_' methods are created. For instance, the following two attributes specified in _attributes will generate methods 'creator', 'cc', 'add_cc', and 'delete_cc': creator => { validation => { type => SCALAR }, }, cc => { list => 1, validation => { type => ARRAYREF }, }, _mark_dirty($attrname) Mark an attribute as dirty. _dirty Return the list of dirty attributes. _mark_dirty_cf($attrname) Mark an custom flag as dirty. _dirty_cf Return the list of dirty custom flags. to_form($all) Convert the object to 'form' (used by REST protocol). This is done based on _attributes method. If $all is true, create a form from all of the object's attributes and custom flags, otherwise use only dirty (see _dirty method) attributes and custom flags. Defaults to the latter. from_form Set object's attributes from form received from RT server. param($name, $value) Set an arbitrary parameter. cf([$name, [$value]]) Given no arguments, returns the list of custom field names. With one argument, returns the value of custom field $name. With two arguments, sets custom field $name to $value. Given a reference to a hash, uses it as a list of custom fields and their values, returning the new list of all custom field names. rt Get or set the 'rt' object, which should be of type RT::Client::REST. DB METHODS
The following are methods that have to do with reading, creating, updating, and searching objects. count Takes the same arguments as "search()" but returns the actual count of the found items. Throws the same exceptions. retrieve Retrieve object's attributes. Note that 'id' attribute must be set for this to work. search (%opts) This method is used for searching objects. It returns an object of type RT::Client::REST::SearchResult, which can then be used to process results. %opts is a list of key-value pairs, which are as follows: limits This is a reference to array containing hash references with limits to apply to the search (think SQL limits). orderby Specifies attribute to sort the result by (in ascending order). reverseorder If set to a true value, sorts by attribute specified by orderby in descending order. If the client cannot construct the query from the specified arguments, or if the server cannot make it out, "RT::Client::REST::Object::InvalidSearchParametersException" is thrown. store Store the object. If 'id' is set, this is an update; otherwise, a new object is created and the 'id' attribute is set. Note that only changed (dirty) attributes are sent to the server. CLASS METHODS
use_single_rt This method takes a single argument -- RT::Client::REST object and makes this class use it for all instantiations. For example: my $rt = RT::Client::REST->new(%args); # Make all tickets use this RT: RT::Client::REST::Ticket->use_single_rt($rt); # Now make all objects use it: RT::Client::REST::Object->use_single_rt($rt); use_autostore Turn autostoring on and off. Autostoring means that you do not have to explicitly call "store()" on an object - it will be called when the object goes out of scope. # Autostore tickets: RT::Client::REST::Ticket->use_autostore(1); my $ticket = RT::Client::REST::Ticket->new(%opts)->retrieve; $ticket->priority(10); # Don't have to call store(). use_autoget Turn autoget feature on or off (off by default). When set to on, "retrieve()" will be automatically called from the constructor if it is called with that object's special attributes (see "SPECIAL ATTRIBUTES" above). RT::Client::Ticket->use_autoget(1); my $ticket = RT::Client::Ticket->new(id => 1); # Now all attributes are available: my $subject = $ticket->subject; use_autosync Turn autosync feature on or off (off by default). When set, every time an attribute is changed, "store()" method is invoked. This may be pretty expensive. be_transparent This turns on autosync and autoget. Transparency is a neat idea, but it may be expensive and slow. Depending on your circumstances, you may want a finer control of your objects. Transparency makes "retrieve()" and "store()" calls invisible: RT::Client::REST::Ticket->be_transparent($rt); my $ticket = RT::Client::REST::Ticket->new(id => $id); # retrieved $ticket->add_cc('you@localhost.localdomain'); # stored $ticket->status('stalled'); # stored # etc. Do not forget to pass RT::Client::REST object to this method. SEE ALSO
RT::Client::REST::Ticket, RT::Client::REST::SearchResult. AUTHOR
Dmitri Tikhonov <dtikhonov@yahoo.com> perl v5.14.2 2011-12-27 RT::Client::REST::Object(3pm)
All times are GMT -4. The time now is 07:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy