Field size finder


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Field size finder
# 1  
Old 02-03-2010
Field size finder

hi
i have a file and its contents is as below:


8290804808
1338108313
1313141441
13131313133
1313131311
33424242242
23242424242

i want to print only those fields in bold. how to do it?
# 2  
Old 02-03-2010
Fields 11 characters long?

Code:
sed "/^.\{11\}$/!d" input_file

or the same in awk
Code:
awk 'length == 11' input_file

# 3  
Old 02-03-2010
Code:
sed -n '/^.\{11\}$/p' urfile
awk -F "" 'NF==11' OFS=""  urfile

# 4  
Old 02-03-2010
thanks a bunch!!! it worksSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. OS X (Apple)

Right-Click scripts and programs in finder

How can I add a right-click option where I can add my own programs and script to finder? (4 Replies)
Discussion started by: codecaine
4 Replies

2. OS X (Apple)

Locking Down Finder Command Preferences

I understand how to lock down things with the finder in workgroup manager, but for matching commands outside of the workgroup manager realm, what's the best way to insert script in order to disable any one of these features? Features workgroup manager highlights: -connect to server -shut... (4 Replies)
Discussion started by: unimachead
4 Replies

3. Shell Programming and Scripting

::select statement return value with correct field size::

Hi Everyone, I am facing a problem regarding the select from sybase, the return with the incorrect size. For example, field is NAME(20). After i selected from sybase, the result is nicky. after i assign it to another declaration variable, it will be in actual name "nicky" , what i need... (10 Replies)
Discussion started by: ryanW
10 Replies

4. Shell Programming and Scripting

Merge files of differrent size with one field common in both files using awk

hi, i am facing a problem in merging two files using awk, the problem is as stated below, file1: A|B|C|D|E|F|G|H|I|1 M|N|O|P|Q|R|S|T|U|2 AA|BB|CC|DD|EE|FF|GG|HH|II|1 .... .... .... file2 : 1|Mn|op|qr (2 Replies)
Discussion started by: shashi1982
2 Replies

5. UNIX for Dummies Questions & Answers

Port finder in unix

Hi, I need to know whether a port is being used by some application. What is the command for the same?? Regards, Chaitrali. (1 Reply)
Discussion started by: Chaitrali
1 Replies

6. Shell Programming and Scripting

validation: set field size to 6 digits

I'm curious, how would I set validation on a field size to make sure it only ever accepts a 6 digit number? I currently have validation for it to be an integer in place but can't find anywhere that says how to make it only a length of 6 digits. any tips on the function I should be focussing... (1 Reply)
Discussion started by: nortypig
1 Replies
Login or Register to Ask a Question