populate specified value in csv


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting populate specified value in csv
# 8  
Old 01-05-2011
Correct. This works. Thanks a lot !

Is there way i can avoid the first row as it is the header, and i don't want to replace there?
# 9  
Old 01-05-2011
Quote:
Originally Posted by john_prince
Correct. This works. Thanks a lot !

Is there way i can avoid the first row as it is the header, and i don't want to replace there?
Code:
awk -F, 'NR>1 && $1{$4="\"DTP\""; $6="\"DSS\""}1' OFS=\, file

# 10  
Old 01-05-2011
Nope, it is not working, still overwriting the header column.
# 11  
Old 01-05-2011
Can you post a better example of your input file and the desired output?
This User Gave Thanks to Franklin52 For This Post:
# 12  
Old 01-06-2011
Hi Franklin,

I am okay with this so far, header value is not that of concern.

Thank you very much.

- John.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Script to populate (2) values in .XML

Good Afternoon Team - I"m asking for assistance on a piece of code to populate two values in an XML file. I have it working perfectly using CScript for DOS, but I have a need to do that same process in a Linux environment. Here is the XML I need to modify: <?xml version="1.0"... (5 Replies)
Discussion started by: SIMMS7400
5 Replies

2. Shell Programming and Scripting

Populate Column Value Using AWK

Hi All, I am trying to find out awk one liner for the following requirement but failed in doing that. I have two files. Content of first file: file1.txt SUCCESS A file2.txt SUCCESS B file3.txt SUCCESS A file4.txt FAIL ... (7 Replies)
Discussion started by: angshuman
7 Replies

3. Shell Programming and Scripting

Shell script to populate an array from a csv file

Hi Guys, I've got a script that runs and collects statistics from one of our machines and outputs the data into a csv file. Now, that script runs fine and I managed to create another one (with a lot of help from this forum!!) to trim the csv file down to all the data that I need, rather than all... (9 Replies)
Discussion started by: jimbob01
9 Replies

4. Shell Programming and Scripting

Create files from a list and then populate them

I have a list of filenames that I want created - they must be created via a certain naming convention due to the software I'm using. Once they are created I have another file that will be used to populate them with data. So far this is what I have: #For each line in text file "foo_txt" create... (2 Replies)
Discussion started by: MaindotC
2 Replies

5. Shell Programming and Scripting

Using eval to populate an array in the background

Hi. I am trying to populate an array using eval in the background within a function. So this function will create a list of 3 character directories from SVN and store in an array. I want to call this function when the script starts in the background unknown to the user. The problem is that... (2 Replies)
Discussion started by: jmiaebrown
2 Replies

6. Shell Programming and Scripting

populate a bash variable from an awk operation

Hi, I'm trying to populate bash script variable, data_size with the size of the largest file in my current directory data_size=$(ls -lS | grep -v "total" | head -1) | awk '{ print $5 }' I've tried adding an echo before the call to awk data_size=$(ls -l | grep -v "total" | head -1) |... (2 Replies)
Discussion started by: mark_s_g
2 Replies

7. Shell Programming and Scripting

PHP populate variable with function

Hi, I've a php scirpt that calls in an external class. The external class, myClass, has several public and private functions. There is one public function which derives a value that I want be able to bring it to the main php scirpt. Here is the code. ....snip.... include... (1 Reply)
Discussion started by: nitin
1 Replies

8. Shell Programming and Scripting

populate PERL Hash

Hello I am new to perl and learning ...can you please explain why am i getting this error...as myHash is defined right above the code and I think it should be avilable in the sub function. Here is my code: <code> #!/usr/bin/perl use warnings; use strict; %myHash=(); sub... (2 Replies)
Discussion started by: uandme2k2
2 Replies

9. Shell Programming and Scripting

populate variable from remote result

Hi there i am trying to pass the result of a remote command into a variable into my script ie #!/bin/sh var = `ssh remote_box 'uname'` echo $var but all i get back is ./script.sh: var: not found However when i add a -x to put it into diag mode i get the following + ssh... (2 Replies)
Discussion started by: hcclnoodles
2 Replies

10. Shell Programming and Scripting

using the getline to populate an array from a file

Hello, I am trying to use the awk getline command to populate an array from a flat file. Has anyone done this before? So we have file1: a b c d I want to create an array like index that contains these four elements (8 Replies)
Discussion started by: penfold
8 Replies
Login or Register to Ask a Question