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.


awk script help


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
awk script help

Hi

I have a comma delimited file with 2 columns, however I need to manipulate it, in such a way that the first column is horizontal and the second column is underneath it.

Code:
text1,123
text2, 345
text3, 678
text4,987

Code:
text1,text2,text3,text4
123,345,678,987

# 2  
if you searched for transpose you'd have found a couple of leads...
awk -F, -f bomb.awk OFS=, myFile where bomb.awk is:
Code:
{for(i=1;i<=NF;i++){a[i,NR]=$i};m=NF;n=NR}
END {
   for(j=1;j<=m;j++)
         for(k=1;k<=n;k++)
           printf("%s%s",a[j,k], (k==n) ? ORS : OFS)
}

This User Gave Thanks to vgersh99 For This Post:
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
Passing shell script parameter value to awk command in side the script
Sarita Behera
I have a shell script (.sh) and I want to pass a parameter value to the awk command but I am getting exception, please assist. diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff |...... UNIX for Dummies Questions & Answers
1
UNIX for Dummies Questions & Answers
Unable to pass shell script parameter value to awk command in side the same script
Ashunayak
Variable I have in my shell script diff=$1$2.diff id=$2 new=new_$diff echo "My id is $1" echo "I want to sync for user account $id" ##awk command I am using is as below cat $diff | awk -F'~' ''$2 == "$id"' {print $0}' > $new I could see value of $id is not passing to the awk...... Post Here to Contact Site Administrators and Moderators
0
Post Here to Contact Site Administrators and Moderators
Passing awk variable argument to a script which is being called inside awk
vivek d r
consider the script below sh /opt/hqe/hqapi1-client-5.0.0/bin/hqapi.sh alert list --host=localhost --port=7443 --user=hqadmin --password=hqadmin --secure=true >/tmp/alerts.xml awk -F'' '{for(i=1;i<=NF;i++){ if($i=="Alert id") { if(id!="") if(dt!=""){ cmd="sh someScript.sh...... Shell Programming and Scripting
2
Shell Programming and Scripting
Help: How to convert this bash+awk script in awk script only?
alexscript
This is the final first release of the dynamic menu generator for pekwm (WM). #!/bin/bash function param_val { awk "/^${1}=/{gsub(/^${1}="'/,""); print; exit}' $2 } echo "Dynamic {" for CF in `ls -c1 /usr/share/applications/*.desktop` do name=$(param_val Name $CF) ...... Shell Programming and Scripting
3
Shell Programming and Scripting
create a shell script that calls another script and and an awk script
magikminox
Hi guys I have a shell script that executes sql statemets and sends the output to a file.the script takes in parameters executes sql and sends the result to an output file. #!/bin/sh echo " $2 $3 $4 $5 $6 $7 isql -w400 -U$2 -S$5 -P$3 << xxx use $4 go print"**Changes to the table...... Shell Programming and Scripting
0
Shell Programming and Scripting

Featured Tech Videos