Sorry, this is not homework, I am not a student anymore. I apologize for my inexperience, I did not know how to use code tags. By variables I mean, for example, if the code requires the path to a file, it would be nice to know that is what an abbreviation means. The data is in several formats, as I was not sure what would be easiest to use - I have it in excel and txt formats (single column with the column names followed by their data, as well as in multiple columns), and the data is in increasing order with no quotes anywhere. I would like the output to be the column name in one cell and then the data in one or more cells (in increasing order, which is the order they are in currently) as it appears above. I am using a new apple computer with Xcode to try to write various "awk" commands to no avail, but due to my lack of experience I am not sure exactly what to use.
Thanks much for the suggestion, jethrow, I will try it!
Moderator's Comments:
At the top of the quick reply frame, you'll see this note:
What that means is that you should select the code icon button at the top of the editing frame to add code tags and then type or paste your sample input data, output data, or code, between the tags it added to your editing frame.
Since you have an excel file containing the data you want to process, use the export as CSV file feature in excel to produce a text file containing your data with commas separating columns in your data. Post a representative sample of your filename.csv file (in CODE tags) and show us the corresponding output that you want the script to produce (in CODE tags).
Also show us the output of the command uname -a so we will be able to tailor the script to the capabilities provided by your operating system.
We may then be able to help you write an awk script to process your data.
PS I haven't examined jethro's suggested awk script in detail, but it uses some constructs (such as the switch() statement) that are not available in standard versions of awk. And it seems to assume that your input file always contains two columns. (I assumed that the
Quote:
etc.
line in your first post meant that there could be several more columns in your input. I'm sure you'll explain how many columns could appear in your input in your next post when you show us your sample input file.)
Dear Guyz:)
I have 2 different input files like this. I would like to pick the values or letters from the inputfile2 based on inputfile1 keys (A,F,N,X,Z).
I have done similar task by using awk but in that case the inputfiles are similar like in inputfile2 (all keys in 1st column and values in... (16 Replies)
Hi All,
I have a file which is having 3 columns as (string string integer)
a b 1
x y 2
p k 5
y y 4
.....
.....
Question:
I want get the unique value of column 2 in a sorted way(on column 2) and the sum of the 3rd column of the corresponding rows. e.g the above file should return the... (6 Replies)
hi,
I have a requirement where in I read the values from a file using awk. The resulting data should be converted into row format from column format.
For ex: My log file login.lst contains the following
SERVER1 DB1
SERVER2 DB2
SERVER3 DB3
SERVER4 DB4
I use awk to grep only the server... (6 Replies)
I have results from some statistical analyses.
The format of the results are as given below:
I want to select lines that have a p-value (last column) less than 0.05 from all the results files (*.results) and cat to a new results file.
It would be very nice if a new column is added that tells... (2 Replies)
Hi Gurus,
I have a tab separated text file with two columns. I would like to make the first column values as headings for the second column values.
Ex.
>value1 subjects
>value2 priorities
>value3 requirements
...etc
and I want to have a file
>value1
subjects
>value2
priorities... (4 Replies)
Hi i have data with two columns like below.
I want to find average of column values like if the value in column 2 is between 0-250000 the average of column 1 is some xx and average of column2 is ww then if value is 250001-5000000 average of column 1 is yy and average of column 2 is zz.
And my... (5 Replies)
Hello All,
I have a below data in a .csv file where all rows where col1 is A, col2 is odd numbers, similarly even numbers for all rows where col1 is B.
Note that my data has some other columns(not shown here) too (around 100) after col2.
Tool,Data
A,1
A,3
A,5
....
so on
B,2
B,4
.... ... (4 Replies)
Hi all ,
I have a file with the below content
Header Section
employee|employee name||Job description|Job code|Unitcode|Account|geography|C1|C2|C3|C4|C5|C6|C7|C8|C9|Csource|Oct|Nov|Dec|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep
Data section ... (1 Reply)
Gents,
It is possible to generate a range of values according to column 1 and count the total of rows in the range.
example
input
15.3
15.5
15.8
15.9
16.0
16.1
16.8
17.0
17.5
18.0
output desired
15.0 - 15.9 = 4 (10 Replies)
Hi Team
I am using DB2 artisan tool and struck to handle multi values present in columns that are comma(,) separated. I want to convert those column values in separate rows .
For example :
Column 1 Column2
Jan,Feb Hold,Sell,Buy
Expected Result
Column1 ... (3 Replies)