Alignment of terms to the left


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Alignment of terms to the left
# 1  
Old 09-11-2007
Alignment of terms to the left

Hi All,

I have a set of data and i want to arrange it in a neater way.
Is there any ways i can align each term to the left such that every field start on the same vertical point

Actual Data


111111 bbb dddd zz
111111 bbbbbb dddd zz
111111 bbbbbbbbb dddd zz
111111 aa dddd zzz
# 2  
Old 09-11-2007
Try...
Code:
$ echo '111111 bbb dddd zz
> 111111 bbbbbb dddd zz
> 111111 bbbbbbbbb dddd zz
> 111111 aa dddd zzz' |\
>  awk '{printf "%-10s %-10s %-10s %-10s\n", $1, $2, $3, $4}'
111111     bbb        dddd       zz
111111     bbbbbb     dddd       zz
111111     bbbbbbbbb  dddd       zz
111111     aa         dddd       zzz

# 3  
Old 09-11-2007
Hi Ygor,

Thanks, it works !!
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Removing duplicate terms in a file

Hi everybody I have a .txt file that contains some assembly code for optimizing it i need to remove some replicated parts. for example I have:e_li r0,-1 e_li r25,-1 e_lis r25,0000 add r31, r31 ,r0 e_li r28,-1 e_lis r28,0000 add r31, r31 ,r0 e_li r28,-1 ... (3 Replies)
Discussion started by: Behrouzx77
3 Replies

2. Shell Programming and Scripting

Grepping multiple terms with different arguments

Grep -e 'term1' -A1 -e 'term2' -A3The above code always searches for either term and prints results + next three lines. I'm trying to print out: foo foo foo term1 bar bar bar line right after the above -- la la la la term2 so so so line right after the above and again and again I've... (7 Replies)
Discussion started by: dkozel
7 Replies

3. Shell Programming and Scripting

Determining Word Frequency of Specific Terms

Hello, I require a perl script that will read a .txt file that contains words like 224.199.207.IN-ADDR.ARPA. IN NS NS1.internet.com. 4.200.162.207.in-addr.arpa. IN PTR beeriftw.internet.com. arroyoeinternet.com. IN A 200.199.227.49 I want to focus on words: IN... (23 Replies)
Discussion started by: richsark
23 Replies

4. Shell Programming and Scripting

How to strip out common terms in string

Hi, I have this kinda of data:- 0,0,0,0,1,2,0,4,5,6,7,foo 0,0,0,0,1,4,0,5,5,5,5,foo1 0,0,6,0,1,6,0,6,1,2,3,orange etc... I wanted to remove the 0 which occur on the same rows of foo,foo1 and orange in this case. Desired output is:- 0,1,2,4,5,6,7,foo 0,1,4,5,5,5,5,foo1... (9 Replies)
Discussion started by: ahjiefreak
9 Replies

5. Shell Programming and Scripting

Grab terms leaving spacings intact

Hi All, I have an input below. I would want to print the 2nd to 5th term leaving the same number of spaces in between each term to be intact. Here in the example, there are 4 spacings between term " ABC " and " 111 ", and i tried the below awk codes but they don;t work. Can anybody give me... (3 Replies)
Discussion started by: Raynon
3 Replies

6. UNIX for Dummies Questions & Answers

Lost with terms

Hi all,in the midst of downloading rpm and various flavors of unix, i encountered some architecture terms and i am confused. Would anyone be kind to enlighten they mean in the world of unix? term: meaning i386: x86_64: IA32: IA64: AMD64: bin: src: (3 Replies)
Discussion started by: new2ss
3 Replies

7. UNIX for Dummies Questions & Answers

Some Basic terms in UNIX

Hello Gurus, I have some very beginner level questions here, which are as follows: 1) I know what is a process, but what is a thread? and how a CPU devides a process into more than one threads and on what basis? Does a programmer designs a program in this way that it devides it into more than... (3 Replies)
Discussion started by: nervous
3 Replies

8. IP Networking

laymens terms for netstat states

Ok, I've read the manpages on netstat and it gives a good description of the state values such as CLOSE_WAIT, ESTABLISHED, SYN_RECEIVED, etc.. Can someone give me real world situations where you would get these states. LIke for example if I got SYN_RECEIVED what possible situations would be the... (1 Reply)
Discussion started by: eloquent99
1 Replies
Login or Register to Ask a Question