Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


Create csv from four disparate files


Login or Register to Reply

 
Thread Tools Search this Thread
# 8  
Code:
for FN in *.out                                 # cycle through ALL *.out files (you could narrow it down somewhat by using *account.out)
  do    H=${FN%%.*}                             # use "parameter expansion" to remove everything beyond first
                                                #   dot (= beyond "host_n") and assign to H
        if [ ! "$H" = "$OH" ]                   # check if new host_n (different from old H)
          then  OH=$H                           # save new $H into old H, and
                {
                echo "host,accounts,max,pwd,standard"                   # print header
                echo $H | paste -d, - $H*.out | sed 's/, \+/,/'         # create csv fields / lines 

                } > $H.result                   # save all output to result file
        fi
  done

This User Gave Thanks to RudiC For This Post:
# 9  
RudiC,
Thank you.
My head was failing at using a new variable within the if statement.
I've a lot learn when it comes to this stuff.

Most of the time I smash on something, poke about this and other sites until I come up with something that works.
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Compare 2 files of csv file and match column data and create a new csv file of them
refrain
Hi, I am newbie in shell script. I need your help to solve my problem. Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file. File1: SourceFile,DateTimeOriginal /home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07...... Shell Programming and Scripting
8
Shell Programming and Scripting
How to create or convert to pdf files from csv files using shell script?
ssk250
Hi, Can anyone help me how to convert a .csv file to a .pdf file using shell script Thanks... Shell Programming and Scripting
2
Shell Programming and Scripting
How to create a .csv file from 2 different .txt files?
alisrpp
Hi, I need to create a .csv file from information that i have in two different tab delimited .txt file. I just want to select some of the columns of each .txt file and paste them into a .cvs file. My files look like: File 1 transcript_id Seq. Description Seq. Length ...... UNIX for Dummies Questions & Answers
2
UNIX for Dummies Questions & Answers
How to create a CSV File by reading fields from separate files
mayanksargoch
SHELL SCRIPT Hi, I have 3 separate files within a folder. Every File contains data in a single column like File1 contains data mayank sushant dheeraj File2 contains DSA_AT MG_AT FLAT_09 File3 contains data 123123 232323... Shell Programming and Scripting
2
Shell Programming and Scripting
Merging files to create CSV file
Ravendark
Hi, I have different files of the same type, as: Time: 100 snr: 88 perf: 10 other: 222 Each of these files are created periodically. What I need to do is to merge all of them into one but having the following form:... Shell Programming and Scripting
2
Shell Programming and Scripting

Featured Tech Videos