Sponsored Content
Full Discussion: Rearange fields within a csv
Top Forums Shell Programming and Scripting Rearange fields within a csv Post 302482291 by drbiloukos on Tuesday 21st of December 2010 07:45:12 AM
Old 12-21-2010
I want to build

Code:
mins;hours;day_of_mon;month;day_of_week;script;conf_file;param1;param2;logfile

but some lines do not use parameters or conf files, so the output will be:

Code:
mins;hours;day_of_mon;month;day_of_week;script;;;;logfile

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to work with fields of a csv file?

I need to insert data into a perticular field of a csv file, lets say second field. Can any one help me to do this? I found that we can do it with sed. can any one guide me to accomplish this? thanks in advance. (12 Replies)
Discussion started by: praveen_b744
12 Replies

2. UNIX for Dummies Questions & Answers

Fields in csv files using sed

Hi, I am working right now with a csv file and I want to insert an excel formula say to the 6th column. sample csv file: 1234,lag,0,77,544,,7 1234,lag,222,0,7,,7 at first i used a simple command: sed 's/^\(.\{17\}\)/\1word/' file.csv but the result is this: ... (2 Replies)
Discussion started by: paoie
2 Replies

3. Shell Programming and Scripting

awk - rearange data

Dear All, once again I am encountering a problem with awk. The file looks like this: BroadLeaves 43.6 clc2006 37.6 Conifers 8.3 edge100 5.1 dem30sec 3.9 aspect 1.5 slope 0 dem30sec 58.3 Conifers 28.5 clc2006 7.3 edge100 3 slope 2.4 BroadLeaves 0.4 aspect 0.1 .... ... .. My... (9 Replies)
Discussion started by: creamcheese
9 Replies

4. Shell Programming and Scripting

How to (n)awk lines of CSV with certain number of fields?

I have a CSV file with a variable number of fields per record. How do I print lines of a certain number of fields only? Several permutations of the following (including the use of escape characters) have failed to retrieve the line I'm after (1,2,3,4)... $ cat myfile 1,2,3,4 1,2,3 $ # Print... (1 Reply)
Discussion started by: cs03dmj
1 Replies

5. Shell Programming and Scripting

pulling different fields from a csv file

Hi, I have a requirment where I need to pull different columns from a .csv file. Here is the sample of the csv file. account,item,flag1,flag2,flag3,flag4,flag5,......feed,tran I will be have a config.txt file which will have the following information. item,flag5,flag10,feed,tran... (2 Replies)
Discussion started by: akdevula
2 Replies

6. Shell Programming and Scripting

compare 2 CSV fields from same diff output

Attached is a file called diff.txt It is the output from this command: diff -y --suppress-common-lines --width=5000 1.txt 2.txt > diff.txt I have also attached 1.txt and 2.txt for your convenience. Both 1.txt and 2.txt contain one very long CSV string. File 1.txt is a CSV dump of... (0 Replies)
Discussion started by: gvolpini
0 Replies

7. Shell Programming and Scripting

Inserting new fields to a csv file

hi I have a csv file with few rows > cat job_stat 1,jobname1,somthing,somthing 2,jobname2,somthing,somthing 3,jobname3,somthing,somthing 4,jobname4,somthing,somthing I want to add few columns after the 2nd column and then append rest of the columns after the 3rd newly added... (3 Replies)
Discussion started by: midhun19
3 Replies

8. Shell Programming and Scripting

Merging fields in CSV

Hi experts, I have a csv file which has one field (ID) repeated multiple times with corresponding other field values. I need to convert this file in a format where for a ID all other values has to be present in single field. For Eg : Here in below file ID 1 is repeated 3 times with different... (7 Replies)
Discussion started by: bharathbangalor
7 Replies

9. Emergency UNIX and Linux Support

How to convert the following characters in some fields in a csv file?

I have a csv file which is produced out of a SED command sed 's/|/","/g; s/^/"/; s/$/"/' A4.txt > A5.csv and I need either an addition to the SED command or a separate command to convert the following characters which occur within the fields in multiple lines 1) "=" to =" and 2)""~ to " (4 Replies)
Discussion started by: etldev
4 Replies

10. UNIX for Beginners Questions & Answers

How to extract fields from a CSV i.e comma separated where some of the fields having comma as value?

can anyone help me!!!! How to I parse the CSV file file name : abc.csv (csv file) The above file containing data like abv,sfs,,hju,',',jkk wff,fst,,rgr,',',rgr ere,edf,erg,',',rgr,rgr I have a requirement like i have to extract different field and assign them into different... (4 Replies)
Discussion started by: J.Jena
4 Replies
holidays(4)							   File Formats 						       holidays(4)

NAME
holidays - prime/nonprime table for the accounting system SYNOPSIS
/etc/acct/holidays DESCRIPTION
The /etc/acct/holidays file describes which hours are considered prime time and which days are holidays. Holidays and weekends are con- sidered non-prime time hours. /etc/acct/holidays is used by the accounting system. All lines beginning with an "*" are comments. The /etc/acct/holidays file consists of two sections. The first non-comment line defines the current year and the start time of prime and non-prime time hours, in the form: current_year prime_start non_prime_start The remaining non-comment lines define the holidays in the form: month/day company_holiday Of these two fields, only the month/day is actually used by the accounting system programs. The /etc/acct/holidays file must be updated each year. EXAMPLES
Example 1: Example of the /etc/acct/holidays file. The following is an example of the /etc/acct/holidays file: * Prime/Nonprime Table for the accounting system * * Curr Prime Non-Prime * Year Start Start * 1991 0830 1800 * * only the first column (month/day) is significant. * * month/day Company Holiday * 1/1 New Years Day 5/30 Memorial Day 7/4 Indep. Day 9/5 Labor Day 11/24 Thanksgiving Day 11/25 day after Thanksgiving 12/25 Christmas 12/26 day after Christmas SEE ALSO
acct(1M) SunOS 5.10 28 Mar 1991 holidays(4)
All times are GMT -4. The time now is 12:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy