Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

--- Finding length of text --

Status
Not open for further replies.

r9ronaldo

Programmer
Jun 19, 2003
28
US
Hi,
I have a problem at hand. Any help is highly appreciated.
I have a table with 16000 rows in which one of the column data type is "long" type. I am unable to find the length of the characters stored in that particular column.
So I used an ETL tool and extracted the data and placed in a text file. I need help in writing a script which can find the length of data stored in that particular
field and later parse it.

As I said I am a rookie to shell scripting, any help is highly appreciated.
Thankyou
RK


 
how 'bout a sample of your input AND a desired output?

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Hi vgersh99,
I have 16000 records in which the field of interest may have character length from 0 to 2^32-1.
My i/p in a particular field is just a description of a particular contract, will be like
&quot;This contract is about buying the products from multiple vendors&quot;
The o/p should be a file containing the record number and length of characters it holds like

record length
1 2000
2 1690
.. ...
16000 50000

I need to find the length so that I can parse it later.

Thanks for your time and help

best regards
RK

 
Something like that?

nawk '{print NR, length($0)}' myFile.txt

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Hi vgersh99,
I am trying to do the way u suggested, but it says
&quot; can't open the file&quot;. Actually I stored the text file on my local machine, whereas the unix runs on the host machine and I remote login to unix.
How do I fix it.
Advance thanks for your help dtime
RK
 
What is your file look like? What output you want to be?
 
'myFile.txt' in my post is the file you want parse - substitute the name for the whatever your file name is.

You need to transfer 'your file' to whatever machine you have UNIX on (unless you have a version of awk on your 'local machines').

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top