Sponsored Content
Top Forums Shell Programming and Scripting Adding an extra date column in UNIX file Post 303024112 by RudiC on Sunday 30th of September 2018 08:08:34 AM
Old 09-30-2018
The result you present is not quite reproducible. -OFS="," causes an error, but when corrected like -vOFS="," , it should yield the desired output without space. You could even simplify your code snippet like
Code:
awk -vd=`date +%Y%m%d` -F"," -vOFS="," '{print $1, d}'  file
22055,20180930
21088,20180930
93840,20180930
30990,20180930
50990,20180930
50950,20180930

This User Gave Thanks to RudiC For This Post:
 

9 More Discussions You Might Find Interesting

1. IP Networking

Adding an extra route to the ip routing table

In my college dorm, there is a file sharing network in the entire building. Problem is, there is only a manual for windows with the settings on how to connect... :mad: They say that you have to give the following command in cmd in windows: route add 172.16.71.0 mask 255.255.255.0... (2 Replies)
Discussion started by: Japie89
2 Replies

2. UNIX for Dummies Questions & Answers

Adding a date as a first column

I want to add a date to a record which is appended to a file that gets its data from an external source. An explanation: 1. Getting external data: curl http://www.example.com/temperatures.txt 2. Getting the required record: | grep mylocation 3. Appending to file: >> mytemperatures.txt ... (2 Replies)
Discussion started by: figaro
2 Replies

3. Shell Programming and Scripting

sort file adding extra character

HI all i have this script : #!/bin/bash sort /usr/tmp/"REPORT"$1 -o \ /usr/tmp/"SREPORT"$1 -k 1,7 -S 150 end of script now i'm doing this command : ls -lsgt *REPORT* 4 -rw-r--r-- 300 Sep 16 REPORT54784 4 -rw-r--r-- 301 Sep 16 SREPORT54784 as you can see the sorted file... (5 Replies)
Discussion started by: naamas03
5 Replies

4. Solaris

Adding Extra Hard Disk

Hi Solaris users - I have an Ultra10 SPARC machine, with IIe processor. To prepare for the Solaris10 admin exam PartII I need to set up the metadb/mirroring in my machine, but do not know how to do this properly. I need this to practice the mirroring tasks. If anyone could help it would be... (3 Replies)
Discussion started by: patcom
3 Replies

5. Shell Programming and Scripting

Adding extra word from file1 to file2

I need to add a word from file1 to file2 accordinggly... file1 contains name of servers and file2 version of server I need that information in a single file so that the format is server_name : version I been trying but havent been able to figure out how to search for a file using sed... ... (14 Replies)
Discussion started by: eponcedeleonc
14 Replies

6. Shell Programming and Scripting

Adding Extra Commas to a CSV file

Trying in this forum. Not sure if it is permitted.... but in need of help. Please find the requirements in the below link. https://www.unix.com/unix-dummies-questions-answers/191503-add-extra-commas-csv-file-2.html#post302665179 Thanks in Advance. (1 Reply)
Discussion started by: chillblue
1 Replies

7. Shell Programming and Scripting

Need help in column comparison & adding extra line to files

Hi, I wanted to check whether the x,y,z coordinates of two files are equal or not. At times, when one file is converted to another suitable file extension , there are some chances that the data mismatch would happen during the conversion. In order to avoid the data misfit, i would like to... (6 Replies)
Discussion started by: b@l@ji
6 Replies

8. Shell Programming and Scripting

Adding Extra Column in txt file base on Condition

HI Guys, I have below input. Output Base on Below Condition. 1> if forth column is empty and next coming line have same name with \es then add that column name on all rows 2>rest of all are es:vsDataEUtranCellFDD Input:- CCL01736 CCL01736_7A_1 es:vsDataEUtranCellFDD ... (3 Replies)
Discussion started by: pareshkp
3 Replies

9. Shell Programming and Scripting

Adding new column data in csv from UNIX

Adding new column data in csv from UNIX Hi I need to add new column data daily to existing csv file. Please assist 7/11 7/10 7/9 7/8 space 10 GB 20 GB I was able to generate current day's data in csv but unable to add the previous 30 days data to the same csv Please use code tags,... (2 Replies)
Discussion started by: archana25
2 Replies
Alzabo::Column(3pm)					User Contributed Perl Documentation				       Alzabo::Column(3pm)

NAME
Alzabo::Column - Column objects SYNOPSIS
use Alzabo::Column; foreach my $c ($table->columns) { print $c->name; } DESCRIPTION
This object represents a column. It holds data specific to a column. METHODS
table Returns the table object to which this column belongs. name Returns the column's name as a string. nullable Returns a boolean value indicating whether or not NULLs are allowed in this column. attributes A column's attributes are strings describing the column (for example, valid attributes in MySQL are 'UNSIGNED' or 'ZEROFILL'. This method returns a list of strings of such strings. has_attribute This method can be used to test whether or not a column has a particular attribute. By default, the check is case-insensitive. It takes the following parameters: * attribute => $attribute * case_sensitive => 0 or 1 (defaults to 0) It returns a boolean value indicating whether or not the column has this particular attribute. type Returns the column's type as a string. sequenced The meaning of a sequenced column varies from one RDBMS to another. In those with sequences, it means that a sequence is created and that values for this column will be drawn from it for inserts into this table. In databases without sequences, the nearest analog for a sequence is used (in MySQL the column is given the AUTO_INCREMENT attribute, in Sybase the identity attribute). In general, this only has meaning for the primary key column of a table with a single column primary key. Setting the column as sequenced means its value never has to be provided to when calling "Alzabo::Runtime::Table->insert". Returns a boolean value indicating whether or not this column is sequenced. default Returns the default value of the column as a string, or undef if there is no default. default_is_raw Returns true if the default is intended to be provided to the DBMS as-is, without quoting, fore example "NOW()" or "current_timestamp". length Returns the length attribute of the column, or undef if there is none. precision Returns the precision attribute of the column, or undef if there is none. is_primary_key Returns a boolean value indicating whether or not this column is part of its table's primary key. is_numeric Returns a boolean value indicating whether the column is a numeric type column. is_integer Returns a boolean value indicating whether the column is a numeric type column. is_floating_point Returns a boolean value indicating whether the column is a numeric type column. is_character Returns a boolean value indicating whether the column is a character type column. This is true only for any columns which are defined to hold text data, regardless of size. is_date Returns a boolean value indicating whether the column is a date type column. is_datetime Returns a boolean value indicating whether the column is a datetime type column. is_time Returns a boolean value indicating whether the column is a time type column. is_time_interval Returns a boolean value indicating whether the column is a time interval type column. is_blob Returns a boolean value indicating whether the column is a blob column. This is true for any columns defined to hold binary data, regardless of size. generic_type This methods returns one of the following strings: integer floating_point character date datetime time blob unknown definition The definition object is very rarely of interest. Use the "type()" method if you are only interested in the column's type. This methods returns the "Alzabo::ColumnDefinition" object which holds this column's type information. comment Returns the comment associated with the column object, if any. AUTHOR
Dave Rolsky, <autarch@urth.org> perl v5.8.8 2007-12-23 Alzabo::Column(3pm)
All times are GMT -4. The time now is 11:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy