General :: Transform Rows Into Columns In Bash

Jul 29, 2011

I would like to transform rows into columns from a file in bash.

View 4 Replies


ADVERTISEMENT

General :: Determine Number Of Rows And Columns Of File In Shell?

Mar 4, 2010

if there's a tab-delimited file under /usr/desktop, how can I determine the number of rows and columns of the file in shell?And, if told the the 3rd column of the file contains only numerical values and all values in the 5th column are unique, how can I verify these in shell?

View 13 Replies View Related

Software :: How To Get 80 Rows By 130 Columns?

Aug 27, 2010

I have been messing with a2ps in order to print a text file I have that has 130 columns by 80 rows per page. It appears that a2ps automatically scales the number of rows based upon the number of columns I try to print.The file prints properly for the columns but a2ps scales the rows to be 97 rows per page. So the 80 rows print but the next 17 rows are blank. It is not scaling the font for for 80 rows.

View 1 Replies View Related

Programming :: Convert Columns To Rows

Aug 10, 2009

I bet this is a Perl one-liner (or very simple python script).I have a tab separated files in which each row looks like:Unique_Eight_Character_Sequence [3 tabs] data1~moredata1~moredata1 [3 tabs] data2~ moredata2~ moredata2 ... dataN~.The output file should have each column converted into a row (with the unique character sequence copied in for the first column), and then each "~" replaced by a comma.

View 14 Replies View Related

Software :: Convert Columns Of Data Into Rows

Jun 28, 2010

I need to create an out put file, last two columns as a row of data (using the first columns as heading) with the file name as first row. For an example the out put file should look like; system_name,0900_in,1000_in,1100_in,1200_in,1300_in,1400_in,0900_out,1000_out,1100_out,1200_out,1300 _out,1400_out
system1,15,17,19,21,23,25,24,26,28,30,32,34

I need to run a script to do above conversion. Need your help.

View 3 Replies View Related

Programming :: AWK (or TCL/TK): Matching Rows And Columns Between Multiple Files?

May 26, 2011

I've been hitting my head against a wall for awhile with this one:As the last part of some data analysis I performing I would to construct a matrix from a series of different files. These files have the format:

file 1 file 2 file 3
AAAAA .1 AAAAA .1 BBBBB .1
BBBBB .2 BBBBB .1 CCCCC .9

[code]...

View 6 Replies View Related

Programming :: Get Number Of Rows And Columns Support In Screen?

Jul 18, 2011

In linux terminal; how can we get the number of rows ad columns from linux kernel? I tried from environment variables(LINES,COLUMNS) but, I could not retrieve them as my editor program is a child process to linux terminal process.

View 7 Replies View Related

Software :: Colorizing Rows/columns In Open Office Calc?

Jun 9, 2010

I highlight a column by selecting "D" > format cells > background > I select a color and press OK. But the color on the document remains the same.

View 3 Replies View Related

Ubuntu :: OpenOffice Draw - Insert A Basic Table With 6 Columns And 3 Rows?

Feb 23, 2010

the color from the table I insert? All I want to do is insert a basic table with 6 columns and 3 rows. I get that, but it has a gradient blue color.

View 1 Replies View Related

General :: Bash And Php Parsing / Not Getting The Data To Output Correctly Into The Rows?

Oct 26, 2010

i am trying to get a script that i'm calling to have information from a sql populate into rows... but i'm not getting the data to output correctly into the rows. can someone please help?

<table>
<thead>
<tr>
<th>Name</th>
<th>Help</th>
<th>Folder</th>
code....

View 14 Replies View Related

General :: Parsing Columns In Bash / Extract The First Set Of Numbers And Get Them To Appear Only Once?

Sep 28, 2009

as a result of a find command, i have

852065 72: /bin/gunzip
852065 72: /bin/gzip
852065 72: /bin/zcat

(the first column is inode number and the second is size if you're curious)

I want to be able to format it in a way such that:
852065 72:
/bin/gunzip
/bin/gzip
/bin/zcat

I know I can get the bottom half using awk- but I can't figure out how to extract the first set of numbers and get them to appear only once

View 9 Replies View Related

General :: Bash Script To Read Csv File With Multiple Length Columns

Jul 27, 2011

I've searched everywhere and I can't come up with a good solution. For each line I need to find the average, min, and max. I've seen plenty of solutions where the number of columns is fixed, unfortunately for me these lines can get pretty large. My thought was to read each line individually into an array, loop through the array and find the avg, min, and max that way but i haven't had much luck. I can read each line using a while loop but I'm having trouble with the array part, or perhaps that's not the best solution?

View 14 Replies View Related

Programming :: Bash Script - Merge Files Comparing Columns

Apr 13, 2011

I have 2 very long files which are quite similar:

file1.csv:

Code:

file2.csv:

Code:

I need this output:


Code:

explanation:

If the fields 3 (serie) and 4 (modello) are identical, the lines of the 2 files should be "added":

Code:

If the fields 3 (serie) and 4 (modello) are different, just print the line of both files:

Code:

Is there a way to do this without reading the (huge) files with a "while read line" loop?

View 14 Replies View Related

General :: Transform PC Into Wireless Router For Home Use?

Feb 16, 2010

I obtained some old PC and I've installed debian linux on it. Now, I have onboard ethernet slot (10/100) and net works fine. Into PC's usb slot I've plugged Bus 001 Device 002: ID 0bda:8189 Realtek Semiconductor Corp. RTL8187B Wireless 802.11g 54Mbps Network Adapter and I want to know is it possible to transform this PC into wireless router for home use? If so, what do I have to do?

View 3 Replies View Related

General :: How To Concatenate Rows Of 2 Files

Apr 3, 2011

How can i concatenate rows of 2 files.

File1:

File2:

How want file3 to be like?

View 14 Replies View Related

General :: Merging Files With Different Number Of Rows Using Awk?

Apr 18, 2011

Does anyone have a solution for merging files if the number of rows in the two (or more) files is non-equivalent.To exemplify, how about merging the following 3 files:

file1:
1
2

[code]...

View 8 Replies View Related

General :: Transform A File On 1st Machine With A Tool On 2nd Machine In One Line Over Ssh?

Jul 14, 2011

I have some file tools on a mint machine that I would rather not install on my mac laptop. Mainly because of the vastness of apt-get and the low risk of installation failure. Anyway, every so often I have a file that I want to process in place using some remote tool. Both machines can ssh right in to each other so I was figuring there must be some script or tool out there that would allow me to type out something like remote [file] [tool & args] to send my file to the other machine, get it processed, then get it back.

View 4 Replies View Related

General :: Debian Resolution Screen And Three Green Rows

Apr 7, 2011

When Debian 6 (amd 64, testing) is loaded, before desktop appears, for a while, the screen is black and three strange green rows appear. Then, all is ok and I can see a normale desktop and start to use Debian. So, an error in video config could be possible. Linked to this fact (I think) , there is the impossibility to modify the resolution screen (that is fixed to 1024x768) and the refresh frequency. I've tried to find "xorg.conf" in order to modify it like various guides suggest me, but this file is not present.

View 1 Replies View Related

General :: Delete Rows Based On Values In A Column Using Sed?

Jan 18, 2011

I have a lot of files with thousands of rows and usually two columns of data. Column 1 is a coordinate, column 2 is a score. I want to delete rows that have a value in column 2 over, in this case, 50.

For example, here's a clip from a file:

2999898 39
2999899 40.9
2999900 42.7
2999901 44.7
2999902 46.7
2999903 48.9
2999904 51.1
2999905 53.3
2999906 55.7

I want the output to be this:

2999904 51.1
2999905 53.3
2999906 55.7

I know how to use sed for very basic things like deleting rows or ranges of rows but I can't figure out this ostensibly easy command.

View 6 Replies View Related

General :: How To Ignore Rows With Specific Character In Csv File?

Mar 11, 2010

I have a csv file that has around 3 million rows. I want to process this file so that it creates a new file that contains only the rows that have 2 characters or less in the first column column.At the moment i am using SQL Loader but its taking too long so im wondering whether this would be easier if done in Unix?

View 8 Replies View Related

General :: The Maximum Number Of Characters And Rows In A Database?

Apr 18, 2010

Is the maximum number of letters a database table column can contain 255?and is it a bad idea to build a table with about 15 columns?

View 1 Replies View Related

General :: Transpose Multiple Rows Into A Single Column?

Apr 7, 2011

I need to transpose a file with over a 1000 rows of 5 columns of numbers into a file with a single column of numbers. The numbers are separated by a single space and range from one digit to 5 digits each. I tried using awk, but can only get it to grab one column of numbers.

Input:

1 2 3 4 50
600 7 8 9000 10
11 12000 13 14 15

Desired output:

1
2
3
4

[code]....

Tried using: awk '{split($0,a,""); print $NF}' <filename> and got:

50
10
15

It only grabbed the last number in each row.

View 13 Replies View Related

General :: Sed - Csv Averages On Command Line - Take The Average Of All Rows With The Same 1st Number(key)

Jul 20, 2010

I have a big file full of records like this

1, 2, 4, 5, 6
1, 3, 5, 6, 3
1, 4, 5, 6, 6
2, 4, 5, 5, 5
2, 3, 4, 5, 2

anyway i need to take the average of all rows with the same 1st number(key). i.e.

1, 3, 4.66, 5.66, 5
2, 3.5, 4.5, 5, 3.5

I know this is something awk/sed would be great for, i just dont have enough experience with them to accomplish it, Also, what about averaging those columns together? so, after I output this to a file, id like to get another like:

1, 4.58
1, 4.125

The number of colums to add might not always be 4 either. EDIT: this might be easier to do in gnuplot, so I mainly just need an answer to the first part.

View 3 Replies View Related

General :: 'automate' That 'rows Selected' Preceded By Number Is Always Last Line

Jul 22, 2010

I'm not that familiar with sed and awk in order to be able to solve this problem on my own, so I'm calling on you for a bit of assistance. I'm writing a Nagios plugin to check our Oracle tablespaces and the output is given in one line like this: 1.04007771 TEMP 0 UNDOTBS1 .005340579 USERS 0 7 rows selected. I've been playing around with sed like below to delete the obsolete info and change every second space into a newline:

[code]...

how many tablespaces there are so I'd have to check all databases and 'hardcode' the tablespaces in my script. Is there any way to 'automate' this knowing that 'rows selected' preceded by a number is always the last line and using a sort of counter to auto-adjust the number to put in the -e 's/ / /2' part?

View 7 Replies View Related

Programming :: Transform Mm:ss:ff To Mm:ss.ss?

Jul 7, 2011

Bash 3.1.7

I have var1 in a script.

Code:
#!/usr/bin/bash
..........
echo var1
with ouput
08:28:10

The format of var1 is mm:ss:ff where ff are units of 1/75 seconds. In order to make of var1 an argument to the flac command (flac --skip=mm:ss.ss where ss.ss are seconds and decimal fraction) I must trasform mm:ss:ff to mm:ss.ss).

First I must isolate ff and place it in say, var2. And then var3=var2/75. How can I do the part (mm:ss:ff --> ff)? Perhaps some way to specify bash to accept ':' as separator?

View 13 Replies View Related

General :: How To Compare Two Columns In A File

Mar 29, 2010

I am trying to write a script which compares a log file with reference file. The log file has a table, the LHS of the table are constants strings and RHS of table values changes if there are any changes in configuration.code...

Here I am looking for a script which compares test.log file ( whose RHS data-types are known prior whether it is digit or string) with test.Ref which is reference file for test.log file. It will be really helpful for me if any of you give some idea about writing this script.

View 2 Replies View Related

General :: Cut Multiple Columns At A Time?

Aug 18, 2010

I am having a souce file (say SOURCEFILE) as below with 5 columns and many rows.

pol name status loan address
123 aaa 21 100 RJY
234 bbb 31 200 RMY
345 ccc 21 300 SJY
456 ddd 41 400 pqr

i want to compare the file (say COMPAREFILE ) which is below :

123
345

I need the following output file (sayOUTPUTFILE) as below :

( ie for file COMPAREFILE i need column 2, column 4 ie name and loan from source file )

ie output file required is to be like below :

123 aaa 100
345 ccc 400

Till now iam using the following method.

1. cutting column 2nd column
2. again cutting 4th column
3. in third, step merging the 2nd and 4 th column.

method of writting single line command or any awk programme to do this in one step.

I need output file (say OUTPUTFILE) as below

View 1 Replies View Related

General :: Merging Columns From Different Files?

Oct 10, 2010

I have three files with the following structure:

file1
1 2 3 4
5 6 7 8

[code]...

View 4 Replies View Related

Programming :: Best Way To Transform XML Format?

Sep 10, 2010

I'm looking for some expert opinion on sed/script to work out the best way to transform one xml format into another however there are a few complexities around translation.

The extra complexities are to:
1) Take the start and stop time (YYYYMMDDHHMMSS) and convert to start time to unix time plus output the difference in seconds between both times.
2) Oid, tsid and sid are found by looking up an external file and finding the value against the channel. For example one of the lines in the file will be 2:806:27e2=channel1

Is there any way to write piped sed commands that can do this? If not, any ideas how the script should look like?

Input File
Code:
<programme start="20100910060000 +0100" stop="20100910061000 +0100" channel="channel1">
<title lang="en">This is the title</title>
<desc>This is the description</desc>
</programme>
Output File

Code:
<service oid="0002" tsid="0806" sid="27e2">
<event id="0">
<name lang="OFF" string="This is the title"/>
<text lang="OFF" string="This is the description"/>
<time start_time="1284098400" duration="600"/>
</event>
</service>

Look up file for oid, tsid and sid
Code:
2:806:27e2=channel1
2:756:37a3=channel2
5:4a06:42e5=channel3

View 8 Replies View Related

General :: Compare Columns Of Uneven Length?

Jan 20, 2011

I have a text file with 2 columns. Column A has 69,000 rows. Column B has 49,000 rows. Column A has our complete product list Column B has product list from Manufacturer 1 There are only certain/some rows which are common between 2 columns. and also, column B is not a subset of column A. Column A has extra entries and so does column B. I need to know, which rows from Column B, are common with Column A which rows from Column B are not common with Column A. Essentially I want to know from this list, how many of our products are from my manufacturer 1, how many does my manufacturer has which we dont carry.

How would I acheive this? My natural approach to solving this kind of obstacle is to reach for MS excel and use its lookup function, but its not working... Its taking forever and hanging up. since the file is so huge and probably my excel skills are really bad.

How can I do this from command line? I am looking for awk command if possible instead of sed since I am trying to pick up its syntax and usage etc. My thought process is, sort column A,B, for every row in A, lookup and output based on condition. Dont know if I am on the right track.

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved