Sponsored Content
Full Discussion: output - tab formatted - awk
Top Forums Shell Programming and Scripting output - tab formatted - awk Post 302375297 by Fredrick on Friday 27th of November 2009 06:51:20 AM
Old 11-27-2009
output - tab formatted - awk

Dear All,

Good Day. I would like to hear your suggestions for the following problem:

I have a file with 5 columns with some numbers in 16 lines as shown below.
Input file:
Code:
Col 1    Col 2   Col 3    Col 4     Col 5
  12      220        2      121        20
 234       30      22         9       156
  25      129    320        94          7
.
.
.
.

I need to do the following

Code:
Col_1new= Col1 ~ Col2   (# difference between Col1 and Col2)
Col_2new= Col2 ~ Col3
Col_3new= Col3 ~ Col4

and so on.

I need the output will be like this

Code:
Col_1new   Col_2new   Col_3new   Col_4new
    208           218          119           101

and so on. The output should be in the column format. I am looking for an awk program to do the same. If anyone help me in this regard.

Thanks in advance.

Warm regards
Fredrick.Smilie

Last edited by radoulov; 11-27-2009 at 07:59 AM.. Reason: Use code tags, please!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Formatted output in KSH

Hi, Is there some way to get formatted output in ksh? Something like a properly alligned tabular format. I tried adding '\t' to echo statements, but it doesn't come properly alligned 'hello' A simple Hello 'helloworld' A helloworld statement I need the second coloumn to... (1 Reply)
Discussion started by: psynaps3
1 Replies

2. Shell Programming and Scripting

Formatted output - awk

Hi I have the following records in a file SABN YOURTUBE 000514 7256 SACN XYOUDSDF 000514 7356 SADN KEHLHRSER 000514 7656 SAEN YOURTUBE 000514 7156 SAFN YOURTUBE 000514 7056 I need to put this in the format like this printf '%s %-50s %6s %-6s\n' I am not going to read individual... (3 Replies)
Discussion started by: dhanamurthy
3 Replies

3. Shell Programming and Scripting

Formatted Output

Hi I have the following lines in a file SWPRC000001NOT STATED 1344 SWPRC000001NOT STATED 1362 SWPRC000001NOT STATED 1418 SWPRC000001NOT STATED 1436 SWPRC000001NOT STATED ... (6 Replies)
Discussion started by: dhanamurthy
6 Replies

4. UNIX for Dummies Questions & Answers

Request for Formatted Output

Can you please tell me how to just get only the output of dealers I & V information along with their subtotals in the next line of the file and create a new file, The dealer position along with corresponding totals may change everyday to any position above or below in the file, please help Thanks (2 Replies)
Discussion started by: Ariean
2 Replies

5. Shell Programming and Scripting

Problems with awk printf, formatted output

Hi, i have a script, which is incomplete, am on my way developing it. Input 1,12,2012,IF_TB001 2,12,2012,3K3 3,Z56,00000,25,229,K900,00, ,3G3, ,USD, ,0000000000,000, , , , 550000000 3,Z56,00000,53,411,W225,00,000, , ,USD,OM170,0000000000,000, , , , -550000000 4,Z56,COUNT, 4,SUM LOC,... (19 Replies)
Discussion started by: selvankj
19 Replies

6. Programming

Formatted output in PERL

Hi Techies, I'm a newbie to PERL, Please help me with following problem. I have an input text file like below cat Input.txt 418673132,P 492538858,P 384535478,P 521522357,I 529435679,I 183617024,P 184414408,I 735510689,P 736238343,I 411642045,I 412690979,I 104232783,I (2 Replies)
Discussion started by: mahi_mayu069
2 Replies

7. Shell Programming and Scripting

awk output seperated by tab

I am just trying to output the below awk separated by tabs. Thank you :). awk (added OFS as an attempt to itroduce tabs) awk '{split($5,a,"-"); OFS='\t' print $1,$2,$3,a}' file.bed > test.bed The awk runs and produces all the data in 1 field instead of 4 fields. current output ... (2 Replies)
Discussion started by: cmccabe
2 Replies

8. Shell Programming and Scripting

awk output is space delimeted not tab delimeted

In the below awk the output is space delimited, but it should be tab delimited. Did I not add the correct -F and OFS? Thank you :). The input file are rather large so I did not include them, but they are tab-delimeted files as well. awk awk -F'\t' -v OFS='\t' 'FNR==1 { next } > ... (2 Replies)
Discussion started by: cmccabe
2 Replies

9. Shell Programming and Scripting

awk to add tab to output of both conditions

In the below awk written by @RavinderSingh13 I have added a few lines and am trying to have the output be tab-delimited. The input is space-delimeted and the portion in bold seems to add a tab to the Not found but not the found. Thank you :). file1 One 1 Two 2 Three 3 file2 One 1... (2 Replies)
Discussion started by: cmccabe
2 Replies

10. UNIX for Beginners Questions & Answers

awk printing leading tab in output

The awk below executes and produces the current output. it skips the header in row 1 and prints $4,$5,$6 and then adds the header row back. The problem is that it keeps the tailing tab and prints it in front of $1. I could add a pipe to remove the tab, but is there a better way to do it with on... (7 Replies)
Discussion started by: cmccabe
7 Replies
wxListView(3erl)					     Erlang Module Definition						  wxListView(3erl)

NAME
wxListView - See external documentation: wxListView. DESCRIPTION
See external documentation: wxListView . This class is derived (and can use functions) from: wxControl wxWindow wxEvtHandler DATA TYPES
wxListView() : An object reference, The representation is internal and can be changed without notice. It can't be used for comparsion stored on disc or distributed for use on other nodes. EXPORTS
clearColumnImage(This::wxListView(), Col::integer()) -> ok See external documentation . focus(This::wxListView(), Index::integer()) -> ok See external documentation . getFirstSelected(This::wxListView()) -> integer() See external documentation . getFocusedItem(This::wxListView()) -> integer() See external documentation . getNextSelected(This::wxListView(), Item::integer()) -> integer() See external documentation . isSelected(This::wxListView(), Index::integer()) -> bool() See external documentation . select(This::wxListView(), N::integer()) -> ok Equivalent to select(This, N, []) . select(This::wxListView(), N::integer(), Options::[Option]) -> ok Types Option = {on, bool()} See external documentation . setColumnImage(This::wxListView(), Col::integer(), Image::integer()) -> ok See external documentation . AUTHORS
<> wxErlang 0.98.9 wxListView(3erl)
All times are GMT -4. The time now is 02:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy