1. I am trying to have each record (line in the CSV file) become its own array, such as $record1[*]
2. There will be lots of strange formatting within the CSV file (i.e. IP addresses, street addresses w/ commas and periods) and right now each record has items 1-35 and it could possibly grow to <=100 fields.
3. I am a newbie :-( .... I have edited BASH scripts in the past ... but that no way make me proficient .... so can someone please help.
P.S. I am pouring over several resources on a daily basis (Beginners & Advanced BASH guides on tldp.org and I have a BASH book that I have my nose buried in constantly. I still need some expert assistance though.
Any help is greatly appreciated.
Last edited by radoulov; 01-05-2011 at 04:04 PM..
Reason: Code tags, please!
I have one group of persons inputting data about sites into a spreadsheet and saving it as someinputdata.csv. Then, I have several template files with VAR_1, VAR_2, VAR_3, and so on declared. I am trying to assign the CSV data to array elements so I can pluck out the data I need with a sed statement like this ...
I really thought it was a simple problem to solve. One group of people is collecting data and one group will be mass producing network devices with the cfg files.
+SNIP+
# set the template variable
TEMPLATE="some text file with VAR_1 in it"
# code here to insert the CSV data into the array ....
..... MISSING ......
# set the variable to the array element
VAR_1=$record1[12]
#
cat $TEMPLATE | sed -e "s/VAR_1/$VAR_1/"g | tee ./output/$VAR_1.cfg >/dev/null 2>&1
HI
I have a dsv file that looks like:
<<BOF>>
record_number|id_number|first name|last name|msisdn|network|points|card number|gender
312|9101011234011|Test Junior|Smith|071 123 4321|MTN|73|1241551413214444|M
313|9012023213011|Bob|Smith|27743334321|Vodacom|3|1231233232323244|M... (4 Replies)
I have 8 .csv files with 16 columns and "n" rows with no Header. I want to parse each of these .csv and get column and put the data into a new.csv. Once this is done, the new.csv should have 16 columns (2 from each input.csv) and "n" rows.
Now, I want to just take the average of Column from... (3 Replies)
Hi everyone,
I have a csv file which has data with different heading and column names as below.
Static Data Ingested
,,,,,,,,,,,,Known Explained Rejections
Column_1,column_2,Column_3,Column_4,,Column_6,Column_7,,% Column_8,,Column_9 ,Column_10 ,... (14 Replies)
I'm not sure if i can put the problem in understandable form.Let me try:
I have a array which is like and always fixed:
Array1=(new inprogress pending Restored Resolved )
Other 2 array array2 which may varry but always subset of above array:
Like it can be :
Array2=(New inprogress... (2 Replies)
Hi All,
I was wondering how I can convert each line in an input file where fields are separated by variable width spaces into a CSV file. Below is the scenario what I am looking for.
My Input data in inputfile.txt
19 15657 15685 Sr2dReader 107.88 105.51... (4 Replies)
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)
Hi, if I want to import .txt file that contain information and the number separate by space how can I split and put into array In C
Example of .txt file
3 Aqaba
49789 10000 5200 25.78
6987 148976 12941 15.78
99885 35262 2501 22.98
Thank (3 Replies)
Hi all,
I have written a shell script to search a specified directory (e.g. /home/user) for a list of specific words (shown as ${TMPDIR}/wordlist below). The script works well enough, but I was wondering if there was a way to display the line number that the word is found on?
Thanks!
cat... (1 Reply)
Hi There
I needed to write a Unix shell script which will pick up the data from a .CSV file and reformat it as per the requirement and write it to another .CSV file.
Currently I am in the proess of Data Import to "Remedy System" (A one kind of incident mangement Application) and this... (8 Replies)
I'm trying to merge multiple CSV (comma separated value) files into one large master file. All files have a field that is unique to act as the key for entry/merging into the master file & and all files have the same number of fields that are in the master file.
I'll give an example here:
... (2 Replies)