Sponsored Content
Top Forums Shell Programming and Scripting How to changes rows to columns in a file Post 302220133 by oracle123 on Thursday 31st of July 2008 02:05:09 AM
Old 07-31-2008
How to changes rows to columns in a file

Hi,

I have a small requirement in chainging the rows to columns. The below example.txt contains info as shown
Name:Person1
Age:30
Name:Person2
Age:40
Name:Person3
Age:50

I want to make it displayed as hown below
Name:Person1 Age:30
NameSmilieerson2 Age:40
Name:Person3 Age:50

I tried by doing the 'tr' command by chaning all new lines to carriage -return it dowsnt work.

i.e. cat example.txt|egrep -i 'Name|Age'|tr '\n' '\t\r' -- it doesnt serve me bcoz the \t is considered but not \r............Please some one help me
Smilie Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert Columns to Rows in a File

Hi I have a input file in the format ABC,111,2008Q2, 49K ABC,111,2008Q3, 0K ABC,111,2008Q4, 0K ABC,222,2008Q2, 49K ABC,222,2008Q3, 0K ABC,222,2008Q4, 0K XYZ,111,2008Q2, 49K XYZ,111,2008Q3, 0K XYZ,111,2008Q4, 0K XYZ,222,2008Q2, 49K XYZ,222,2008Q3, 0K XYZ,222,2008Q4, 0K The output file... (3 Replies)
Discussion started by: chrismt
3 Replies

2. Shell Programming and Scripting

Rows to Columns - File Transpose

Hi I have an input file and I want to transpose it but I need to take care that if any field is missing for a record it should be popoulated with space for that field - using a shell script INFILE ---------- emp=1 sal=2 loc=abc emp=2 sal=21 sal=22 loc=xyz emp=5 loc=abc OUTFILE... (10 Replies)
Discussion started by: 46019
10 Replies

3. Shell Programming and Scripting

Changing file with rows and columns into just 1 column

Hi I need a bash shell script that will take text files with 4 rows and different numbers of columns in each row and convert each one into a text file with just one column. I then subtract 1.5 from each number in the column (I have that part already) The next step after that is I want to have... (10 Replies)
Discussion started by: ac130pilot
10 Replies

4. Shell Programming and Scripting

Large file - columns into rows etc

I have done a couple of searches on this and have found many threads but I don't think I've found one that is useful to me - probably because I have very basic comprehension of perl and beginners shell so trying to manipulate a script already posted maybe beyond my capabilities.... Anyway - I... (26 Replies)
Discussion started by: Myrona
26 Replies

5. UNIX for Dummies Questions & Answers

Audit Flat File - # of Columns / Rows

We receive a file which usually has 40 to 50 million rows. I want to set up an audit process by which everytime we receive a file we audit it for # of rows and total number of columns. So if the # of rows is around 1 million on a particular day, I want to raise a flag or send an email....and if... (3 Replies)
Discussion started by: priya33184
3 Replies

6. Shell Programming and Scripting

Convert columns to rows in a file

Hello, I have a huge tab delimited file with around 40,000 columns and 900 rows I want to convert columns to a row. INPUT file look like this. the first line is a headed of a file. ID marker1 marker2 marker3 marker4 b1 A G A C ... (5 Replies)
Discussion started by: ryan9011
5 Replies

7. UNIX for Dummies Questions & Answers

Swapping the columns of a text file for a subset of rows

Hi, I'd like to swap the columns 1 and 2 of a space-delimited text file but only for the first 1000 rows. How do I go about doing that? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies

8. Shell Programming and Scripting

Converting rows to columns in csv file

Hi, I have a requirement to convert rows into columns. data looks like: c1,c2,c3,.. r1,r2,r3,.. p1,p2,p3,.. and so on.. output shud be like this: c1,r1,p1,.. c2,r2,p2,.. c3,r3,p3,.. Thanks in advance, (12 Replies)
Discussion started by: Divya1987
12 Replies

9. Shell Programming and Scripting

Deleting all the fields(columns) from a .csv file if all rows in that columns are blanks

Hi Friends, I have come across some files where some of the columns don not have data. Key, Data1,Data2,Data3,Data4,Data5 A,5,6,,10,, A,3,4,,3,, B,1,,4,5,, B,2,,3,4,, If we see the above data on Data5 column do not have any row got filled. So remove only that column(Here Data5) and... (4 Replies)
Discussion started by: ks_reddy
4 Replies

10. Shell Programming and Scripting

Character screening and paste into new file in columns instead of rows

QL10169_SAUJANA%SubNetwork=ONRM_ROOT_MO_R,SubNetwork=ERBS_KCRN11,MeContext=QL10169_SAUJANA_5 %External_Link_Failure %X2_link_problem_to_one_or_several_neighbouring_eNodeBs. QL10187_MATANG_JAYA_2%SubNetwork=ONRM_ROOT_MO_R,SubNetwork=ERBS_KUCHING,MeContext=QL10187_MATANG_JAY A_2_3... (2 Replies)
Discussion started by: Ankit Vyas
2 Replies
LES(8)							       Maintenance Commands							    LES(8)

NAME
les, bus - ATM LAN Emulation service demons SYNOPSIS
les [-d module] [-m module] [-f configuration_file] bus [-d module] [-m module] [-f configuration_file] DESCRIPTION
LE Service consists of three components: LAN Emulation Configuration Server (lecs(8)), LAN Emulation Server (les) and Broadcast and Unknown Server (bus). Les performs the control coordination function for the emulated LAN. LE clients register MAC addresses and/or route descriptors they rep- resent to les, and later query it when they want to resolve MAC addresses/route descriptors into ATM addresses. Other LE control messages which are to be distributed to every client in ELAN are also sent to les. Les forwards these messages using Control Distribute VCC which it has set up to every client in ELAN. Bus handles data sent by clients to broadcast and multicast MAC addresses and some of the data directed to unicast addresses. LE Client has a possibility to send data directed to some unicast address to the bus before target's ATM address has been resolved and the Data Direct VCC has been established. Configuration file example for les and bus: [main] memdebug=True debug=True [load] #memdebug=True #debug=True [conn] debug=True #S1, LE Server's ATM address #S1=:47:00:23:00:00:00:03:00:00:01:00:02:01:00:20:ea:00:05:aa:00 S1=:47:00:23:00:00:00:03:03:00:01:00:02:01:00:20:ea:00:0a:e9:01 #S2, LAN Type S2="802.3" #S3, Maximum Frame Size S3=1516 #S4, Join Timeout, s S4=15 #S5, Maximum Frame Age, s S5=6 #S6, BUS Atm address S6=:47:00:23:00:00:00:03:03:00:01:00:02:01:00:20:ea:00:0a:e9:02 #viulu #S6=0,0,170 #ELANNAME="asdf" The configuration file contains each modules name in brackets followed by variable definitions for that module. The definitions are of form variable=value, where value can be either an integer, a truth value (True/False), a string enclosed in double quotes ("string") or an ATM address in hexadecimal format. Variables that can be set are the debug/memdebug for each module and variables S1-S6 as defined in LE speci- fication. S1=Address of the LES. This address is used in ATM signalling. S2=Type of the emulated LAN. Valid values is "802.3". S3=Maximum frame size. Valid value is 1516. S4=Join Timeout. Time in seconds which LES waits for LE_JOIN_REQUEST before tearing down a connection. S5=Maximum frame Age. Currently not used. S6=Address of the BUS. This address is used in ATM signalling. ELANNAME= Name of the emulated LAN SIGHUP causes restart of the server. All resources are released and server is started. SIGUSR1 causes the server to dump its internal state. SIGUSR2 shuts down the server (hopefully) gracefully. OPTIONS
-d module Set debugging messages on for a module. "All" sets debugging on for all modules. -m module Set memory debugging messages on for a module. "All" sets debugging on for all modules. -f configuration_file Use the specified configuration file instead of .lanevars. FILES
.lanevars configuration file BUGS
Servers don't establish point-to-multipoint connections to LE clients as the specification states, which means that some LE clients won't work with these servers. Supports only IEEE 802.3 / Ethernet type of ELANs. This manual page is confusing. AUTHOR
Marko Kiiskila, TUT <carnil@cs.tut.fi> SEE ALSO
lecs(8), atmsigd(8), zeppelin(8) Linux Sep 11, 1996 LES(8)
All times are GMT -4. The time now is 06:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy