wbshrk
November 4, 2009, 1:52pm
1
I am trying to write a shell scrip that can give me the line length of a record that was in EBDIC and then converted to ASCII. Everything I try reports 1 yet the length is 2000+. I have tried
echo "Line length : ${#FILE }"
echo "FILE" |awk -F, '{print NF}'
awk '{lenth(file)}'
All I can tell is that there is a charcter or something that says end of line even i it is not end of line.
Can anyone give me another way to count every character in a line until the line break?
Is there a null string (\000) in the line?
wbshrk
November 4, 2009, 2:26pm
3
No there is a ^k\204 at the start
How do you read the line into the variable?
What is the output when you pipe it through hexdump or od -c?
wbshrk
November 4, 2009, 2:47pm
5
I am jut typing the code in on the command line so it is read in at FILE listed above
od -c gives me:
\v 204 \0
for the fist set of characters.
HOW is it read into the FILE variable?
What code do you use?
\0 is a NUL and ends the string.
wbshrk
November 4, 2009, 2:53pm
7
Ok if \0 is null how do I get around that? These are all over the record and need to be counted.
I repeat:
HOW do you get the information into the FILE variable?
wbshrk
November 4, 2009, 3:07pm
9
As I said befor I have used one of the line in my first post. I am reading in the raw converted file. After that I don't know what you mean by reading in the file. I am jsut typing in the file name.
Please post the code that puts the line into the variable, FILE.
wbshrk
November 4, 2009, 4:10pm
11
echo "Filename.txt" |awk -F"\0", '{print NF}'
this is waht the code looks like. just like the first post.
wbshrk:
PLEASE put code inside
```text
...
```
tags.
echo "Filename.txt" |awk -F"\0", '{print NF}'
this is waht the code looks like. just like the first post.
That was not in your first post
It doesn't put anything into the FILE variable.
Where is the line that begins:
FILE=