Sponsored Content
Full Discussion: Adding columns to a file
Top Forums UNIX for Dummies Questions & Answers Adding columns to a file Post 302196099 by rubin on Friday 16th of May 2008 05:25:10 PM
Old 05-16-2008
Code:
awk -v d="$(date "+%Y-%m-%d")" '{print "abc", d, $1}' foo.csv > foo.txt

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl: adding columns in CSV file with information in each

Hi Wise UNIX Crew, I want to add 3 different columns to the file in which: 1. The first new column pulls in today's date and time 2. Second column one has a '0' 3. Third column has the word 'ANY' going down the column If my file content is as follows: "7","a","abc",123"... (1 Reply)
Discussion started by: dolo21taf
1 Replies

2. Shell Programming and Scripting

Need Help for Adding Three new columns in existing file from fatching data from file

not required this time (36 Replies)
Discussion started by: Sandeep_Malik
36 Replies

3. UNIX for Dummies Questions & Answers

Adding EMPTY columns to Tab-delimited txt file

Hi I have a txt file with 4 columns where I need to add 4 empty columns in the middle meaning that I need what is currently column 4 to be column 8 in a new file. The idea is that I have to use the file as input in a program that reads the data in column 1 and 8, so the content of the other... (8 Replies)
Discussion started by: Banni
8 Replies

4. UNIX for Dummies Questions & Answers

Adding lines and columns to a file

Hi everybody, I've got two simples file1 like: aaa aaa aaa bbb bbb bbb ccc ccc ccc and file2 like: 111 111 111 222 222 222 333 333 333 I need to: 1) add a line say "new line" as the first line of the file 2)add a column from file2 (say column3) to file1; the new column should... (14 Replies)
Discussion started by: zajtat
14 Replies

5. Shell Programming and Scripting

Suggestions for adding columns to text file

Good afternoon to everyone, I have some input and output from various widgets that I am trying to get to play nicely together. Basically I would like to stay out of excel and be able to automate the entire process. I have read some posts here about how to use awk, nawk, etc, to do similar... (9 Replies)
Discussion started by: LMHmedchem
9 Replies

6. Shell Programming and Scripting

Adding a new column in a file with other existing columns

Hi All , Kindly help me with this soln awk '{printf "%s %7s \n", $1,$c}' infile where value of variable c I am externally giving input But executing the above command shows all the columns of infile where as I want only 1st column of infile and 2nd column should print value c (8 Replies)
Discussion started by: Pratik4891
8 Replies

7. Shell Programming and Scripting

Unix File - Adding columns in the middle

Hello, I have a comma separated flat file. It contains some 20 columns. I want to add two new columns at position 2,3. So that file will have 22 columns. I am providing here sample data with file having 4 columns. Appreciate your help in finding solution for this. data in input file:... (11 Replies)
Discussion started by: ravi.videla
11 Replies

8. Shell Programming and Scripting

Help needed: Adding columns in csv file in loop

Hi Everyone: My shell script creates multiple csv files (~30) in for loop. I want to compile (or merge) 3rd column from each (all) of these files to another file (in loop). Please help. Thanks. (3 Replies)
Discussion started by: smap007
3 Replies

9. UNIX for Dummies Questions & Answers

Perl - adding columns to file

I have a file in which I need to add more columns to based on a key in the first file: File1 key1,abc,123, key2,def,456, key3,ghi,789, File2 key2,zyx,111,qqq, key3,yuu,222,www, key1,pui,333,eee, key4,xxx,999,rrr, I would like to create the following output: Output (1 Reply)
Discussion started by: WongSifu
1 Replies

10. UNIX for Dummies Questions & Answers

Solaris - Filter columns in text file and adding new column

Hello, I am very now to this, hope you can help, I am looking into editing a file in Solaris, with dinamic collums (lenght varies) and I need 2 things to be made, the fist is to filter the first column and third column from the file bellow file.txt, and create a new file with the 2 filtered... (8 Replies)
Discussion started by: jpbastos
8 Replies
MixinFactory::HasAFactory(3pm)				User Contributed Perl Documentation			    MixinFactory::HasAFactory(3pm)

NAME
Class::MixinFactory::HasAFactory - Delegates to a Factory SYNOPSIS
package My::BaseClass; @ISA = 'Class::MixinFactory::HasAFactory'; sub new { ... } sub foo { return "Foo Bar" } package My::Logging; sub foo { warn "Calling foo"; (shift)->NEXT('foo', @_) } package My::UpperCase; sub foo { uc( (shift)->NEXT('foo', @_) ) } package main; use My::BaseClass; print My::BaseClass->class()->new()->foo(); print My::BaseClass->class( 'Logging' )->new()->foo(); print My::BaseClass->class( 'UpperCase' )->new()->foo(); print My::BaseClass->class( 'Logging', 'UpperCase' )->new()->foo(); DESCRIPTION
A class for use by classes which want a factory method. Inherit from this class to obtain the class() factory method, described below. PUBLIC METHODS
mixin_factory() BaseClass->mixin_factory() : $factory_object Gets the associated mixin factory. Generated the first time it is needed. class() BaseClass->class( @mixins ) : $package_name Calls the class() method on the associated mixin factory. SEE ALSO
For a facade interface that facilitates access to this functionality, see Class::MixinFactory. For distribution, installation, support, copyright and license information, see Class::MixinFactory::ReadMe. perl v5.10.1 2009-12-10 MixinFactory::HasAFactory(3pm)
All times are GMT -4. The time now is 09:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy