08-09-2008
use awk to read randomly located columns in an excel file
Hi,
I have an excel file that have a random count of columns/fields and what im trying to do is to only retrieve all the rows under 2 specific field headers.
I can use the usually command for awk which is awk 'print{ $1 $2}' > output.txt, but the location of the 2 specific field headers is not constant so it will not be useful to use the command.
example:
(headers needed are name & age)
for today the generated column count and location of needed headers are:
name age sex location company
the next day the column count and location of the needed headers might be
company
age location id
name address
Is there a command that can be used just to read the headers that i just need and then once the headers are found retrieve all the rows under the header and place them to output.txt?
Thanks,
mdap
Last edited by mdap; 08-09-2008 at 11:28 AM..
10 More Discussions You Might Find Interesting
1. Programming
hi..
i have the next question:
i need to read an excel file (xls) using a C program. Is that possible?
how can i do that?
please, any idea
thanks (6 Replies)
Discussion started by: DebianJ
6 Replies
2. Shell Programming and Scripting
I have data file with customer.dat, and this contains the customer names
>cat customer.dat
FirstName1 LastName1
FistName2 LastName1
FistName3 MiddleName3 LastName3
This file can contain areoun 100 customer names.
Regards, (1 Reply)
Discussion started by: McLan
1 Replies
3. Shell Programming and Scripting
hi guys, i would like to print two lines from a file as two adjacent columns using excel using awk.. i have this so far:
awk '{for(i=1; i<=NF; i++) {printf("%s\n",$i)}}' "$count".ttt > "$count".csv #this to print the first line from the .ttt file as rows of the first column in the .csv... (9 Replies)
Discussion started by: npatwardhan
9 Replies
4. Shell Programming and Scripting
i have this file which has the following contents:
,-0.3000 ,-0.3000 ,-0.3000
,-0.9000 ,-0.9000 ,-0.9000
i would like to get this:
-0.3-0.9-0.3-0.9-0.3-0.9
so far i am trying:
awk '{for(i=1; i<=NF; i++) {printf("%f\n",$i)}}' test1 > test2
any help... (4 Replies)
Discussion started by: npatwardhan
4 Replies
5. Shell Programming and Scripting
i want sort columns with headers based on another file headers
file1
eg: i'm having an empty file with only coumn names like
lastname firstname title expirydate stlcno status etc...
another file with same column names and some other as well but in different order...
file2
eg:firstname... (2 Replies)
Discussion started by: Man83Nagesh
2 Replies
6. UNIX for Dummies Questions & Answers
Hi All,
i have a excel sheet with two columns as below.
column1 column2
100 100
200 300
300 400
400 400
500 600
i need to compare the values these two columns and the output should be printed in the third column...if these values are equal the output should be green and if these... (2 Replies)
Discussion started by: arunmanas
2 Replies
7. UNIX for Dummies Questions & Answers
Dear all,
I have one file (see below) with more then 100 columns and 2500 rows, and need only column which has GType in label with Alphabets, please help me to remove these columns with numbers.
input file is
n.201.GType n-201.Theta n-201.R n_1.GType n_1.Theta n_1.R... (6 Replies)
Discussion started by: AAWT
6 Replies
8. Shell Programming and Scripting
Hi Tech Guru,
I have a test file as below , which needs some more fields to be populated randomly :
dks3243;12;20130823;1420;25m;0;syt
dks3243;rocy;10
dks3243;kiop;18
sde21p4;77;20151210;8479;7py;9;vfr
sde21p4;temp;67
sfq6i01;12;20120123;3412;4rd;7;jui
sfq6i01;uymk;90
sfq6i01;kiop;51
... (8 Replies)
Discussion started by: Lokesha
8 Replies
9. UNIX for Dummies Questions & Answers
Hi!
It's been a week now that connections to my server are slow. I can transfer one file of 6 GB at 50 MB/s but with a folder of the same size with multiple files I go down to 4 MB/s. Also, browsing a folder with multiple files takes a lot more time for the files to show. The only thing I've... (9 Replies)
Discussion started by: Boogie
9 Replies
10. Shell Programming and Scripting
Hi All...
I am in need of few columns from a log file.. in .xls file... below is what i have tried.
my log file has 16 colums with " ; " as delimiter, but i need randomn columns 1 2 3 4 5 6 10 11 16 in an excel.
I tried to awk the columns with delimiter ; and it worked, below is the log... (5 Replies)
Discussion started by: nanz143
5 Replies
IGAWK(1) Utility Commands IGAWK(1)
NAME
igawk - gawk with include files
SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ...
igawk [ all gawk options ] [ -- ] program-text file ...
DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1).
AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like
@include getopt.awk
in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path.
OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports.
EXAMPLES
cat << EOF > test.awk
@include getopt.awk
BEGIN {
while (getopt(ARGC, ARGV, "am:q") != -1)
...
}
EOF
igawk -f test.awk
SEE ALSO
gawk(1)
Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995.
AUTHOR
Arnold Robbins (arnold@skeeve.com).
Free Software Foundation Nov 3 1999 IGAWK(1)