Request for horizontal formatting code


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Request for horizontal formatting code
# 1  
Old 06-19-2012
Request for horizontal formatting code

The input file contains 4 bytes per row
Code:
 
1 2 3 4
5 6 7 8
9 10 11 12
* * * 108
 
1 2 3 4
5 6 7 8
9 10 11 12
* * * 108

I need to put them in a horizontal manner and this need to repeat after every 108 lines lso the output comes as
Code:
1 2 3  4 5  6 7 8 9 10 11 12 ..... 108
1 2 3  4 5  6 7 8 9 10 11 12 ..... 108

Moderator's Comments:
Mod Comment please format data with code tags

Last edited by jim mcnamara; 06-19-2012 at 02:01 PM..
# 2  
Old 06-19-2012
What have you tried and what errors did you get?
# 3  
Old 06-19-2012
So, you want to group every 27 lines? (27 * 4 = 108)
# 4  
Old 06-19-2012
Look at this site.

For every 108th line
Code:
awk 'ORS=NR%108?",":"\n"' input >output

For every 27th line
Code:
awk 'ORS=NR%27?",":"\n"' input >output

# 5  
Old 06-20-2012
Try:
Code:
xargs -n108 < file

Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl code request

Hi Perl Experts, I am new to Perl programming. can somebody please help me in writing Perl code for following "find and replace logic". i wanted to find following line in list of files in a given directory. ================================================ for(i=0;i <... (2 Replies)
Discussion started by: chettyravi
2 Replies

2. Shell Programming and Scripting

Formatting wget request within script

When using a browser and calling this url .. the data returns the proper range of information ichart dot finance dot yahoo dot com/table.csv?s=YAHOO&a=3&b=14&c=2012&d=03&e=20&f=2012&g=d&ignore.csv (geeze wont let me post url's sorry ) However in my script the formatting is messing up on... (4 Replies)
Discussion started by: harte
4 Replies

3. Windows & DOS: Issues & Discussions

Code tag like formatting in Outlook?

Hi, Not a shell scripting question ,but searched a lot over google ..but no success. How do put codes in outlook 2007 mail messages in good manner like the code tags option while posting in this forum :). Apologies if the question is very irrelevant or the solution is very simple. Regds,... (1 Reply)
Discussion started by: kunwar
1 Replies

4. Shell Programming and Scripting

CSV file horizontal formatting

Hi folks, Please help me with csv file formatting which needs to be done in horizontal fashion. I have data coming in separate files every hour. What I need to do is extract three values into csv file. In the next hour, I need to extract the new values beside the three values which were... (1 Reply)
Discussion started by: vharsha
1 Replies

5. Shell Programming and Scripting

Formatting isql output to horizontal format

Hi I am formatting informix isql output(vertical) to horizontal format. Suppose I have the following content in the flat file from isql output - item_nbr 0 usfn_label Subscriber Class usfn_name SBCLASS usfn_value bl5 item_nbr 1 usfn_label Switch Name usfn_name switchName... (2 Replies)
Discussion started by: nsinha
2 Replies

6. Shell Programming and Scripting

Request to code review Suggestions Plz

Hello All, I have 2 questions, 1) I am on Unix Sun Solaris korn shell, in my shell scripts i am using #!/bin/sh Instead of #!/bin/ksh, though it is still working is this correct way of doing and also I am saving the shell script file as abc.sh instead of abc.ksh, please let me know the best... (1 Reply)
Discussion started by: Ariean
1 Replies
Login or Register to Ask a Question