Formatting in a table via shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Formatting in a table via shell
# 1  
Old 02-01-2017
Formatting in a table via shell

Hi

I have the below output:

Code:
736f14c4-eda2-4531-9d40-9de4d6d1fb0f
An account already exists for this email address. Please enter a different email address.
c3716baf-9bf8-42da-8a44-a13fff68d20f
An account already exists for this email address. Please enter a different email address.

Is it possible to have a tabulated form like

Code:
ID                                                              Message

736f14c4-eda2-4531-9d40-9de4d6d1fb0f          An account already exists for.......email address.

I have no clue regarding the same. I tried AWK to format but not getting the expected result.
# 2  
Old 02-01-2017
Please post your attempts.
# 3  
Old 02-01-2017
Used this to have them in a single line:

Code:
awk '{printf "%s%s",$0,(NR%2?FS:RS)}' filename

now i am getting like this:

Code:
736f14c4-eda2-4531-9d40-9de4d6d1fb0f An account already exists for this email address. Please enter a different email address.
c3716baf-9bf8-42da-8a44-a13fff68d20f An account already exists for this email address. Please enter a different email address.

# 4  
Old 02-01-2017
So you're almost there...? You may want to set FS to <TAB>, and you may want to print a header line in a BEGIN section.
# 5  
Old 02-01-2017
Hi.
Code:
paste - - < your-file-name

produces:
Code:
736f14c4-eda2-4531-9d40-9de4d6d1fb0f    An account already exists for this email address. Please enter a different email address.
c3716baf-9bf8-42da-8a44-a13fff68d20f    An account already exists for this email address. Please enter a different email address.

Best wishes ... cheers, drl
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Table like formatting in Linux

Dear experts, I need bit help in formatting .. I have csv file file , i will read that file by passing one column value as input parameter and display header row and corresponding row for that parameter. I have shell script like this: #!/bin/bash #key_word_I_am_looking_for=$1 #awk... (16 Replies)
Discussion started by: onenessboy
16 Replies

2. Shell Programming and Scripting

Help with formatting file in C shell!

Hi Guys, I have written a matlab script that does, thresholding of the data and creates a single column of data which i save as a text file in my home directory. Now would like to format that text file so that I all the numbers are 4 digits, if not than add 000 in front of the number if number is... (3 Replies)
Discussion started by: dixits
3 Replies

3. Shell Programming and Scripting

Formatting File Using Shell Script

Hi Team, We have a requirement where we need to format input file using shell script by meeting the below conditions. 1. 1. Ignore first 549 characters of that file. 2. 2. After that we need to make a file of 100 characters per line, repeat it until the 3rd ... (16 Replies)
Discussion started by: ataneja7
16 Replies

4. Shell Programming and Scripting

formatting a shell script

there is one shell which calls for different sql scripts. output of different are formatted in frame like structure.i want columnar wise formatting to be done in such a manner that output of one sql may be comon input of rest sqls . ERC DML Closure Date ER DML SAP Transfer Date ... (0 Replies)
Discussion started by: arc
0 Replies

5. Shell Programming and Scripting

Korn Shell Date Formatting

I am serching for a file created today like so: TODAY=$(date +"%b-%d") T_FILE=$(find /export/home/dan/ck/reports/t-status-t.txt-$TODAY-05-00-0?.csv) The file it is searching for is titled: /export/home/dan/ck/reports/t-status-t.txt-Jun-29-05-00-01 however, I when... (2 Replies)
Discussion started by: ther2000
2 Replies

6. Shell Programming and Scripting

Help with shell script in formatting the records.

I have a text file in the following format. can any one please help me in printing the output in userfriendly format mentioned below. Input. 1) /ss/abc/1/w/s/domainname/abc1/logname/ ########error################### ########error################### ########error###################... (2 Replies)
Discussion started by: vinny81
2 Replies

7. Shell Programming and Scripting

[SHELL] Output formatting

I am looking for a way to format the output of this string into comma separated values (.csv) so I can import into excel. Also I want to remove any white space generated by the commands, particularly the dmidecode as the output has lots of space in front of Serial Number. #!/bin/bash for... (8 Replies)
Discussion started by: Adrnalnrsh
8 Replies

8. Shell Programming and Scripting

help on formatting output (Table Form)

Data in File ABC:DEFGHI:123 ABCZYE:DEFI:123 ABCFGD:DEF:123 ABCEERRRRR:DEFGHI:123 Expected Format 1 ABC DEFGHIFE 123 2 ABCZYE DEFI 123 3 ABCFGD DEF 123 4 ABCEERRRRR DEFGHI 123 However when i enter the following... (2 Replies)
Discussion started by: blurboy
2 Replies

9. Shell Programming and Scripting

formatting a file using shell script

Hi I have to do the following.I have to format a file test.t The contents are # Header 1231 xyz asdf asdapsdcsd //string1 = "pqrs" //string1 = "abcd"; //info //string1 = "*pqrs"; //add string1 = "#123"; //sub //string1 = "#1234567890" data = check(string1) //string1 = "#1234567890"... (12 Replies)
Discussion started by: gopsman
12 Replies

10. UNIX for Advanced & Expert Users

Date Formatting in Shell Script

Hi, Can anybody throw somelight on how to handle date in a shell script? I need to pass the date in this format 'yymmdd' and then pad it to a file. The way in which i've handled is given below, but the date is not getting passed rather the file is getting created with a null date. Any... (2 Replies)
Discussion started by: Isiva
2 Replies
Login or Register to Ask a Question