Solved

file line size

Posted on 2010-08-12
8
526 Views
Last Modified: 2013-12-26
Can u please let me know if the line size is 350 in attached file.
Are can u please let me know an easy way to check this. I transfered teh file from unix to windows b4 attaching here, since the file is in unix directory.
test
0
Comment
Question by:Sara_j_11
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 167 total points
ID: 33424043
no
perl -ne 'print length,"\n"' test
0
 
LVL 23

Expert Comment

by:Maciej S
ID: 33424069
Each line has 344 characters.
[maciek@black:~/EE]% cat test| while read line; do echo -n ${line} | wc -c; done

344

344

344

344

344

344

[maciek@black:~/EE]% 

Open in new window

0
 

Author Comment

by:Sara_j_11
ID: 33424089
wehn i execute it I get the result:
as
345
345
345
345
345


does that mean that line size is 345?
0
 
LVL 23

Expert Comment

by:Maciej S
ID: 33424116
345 with "new line" character (344 without it). Yes.
0
New My Cloud Pro Series - organize everything!

With space to keep virtually everything, the My Cloud Pro Series offers your team the network storage to edit, save and share production files from anywhere with an internet connection. Compatible with both Mac and PC, you're able to protect your content regardless of OS.

 
LVL 84

Expert Comment

by:ozo
ID: 33424386
not counting the line terminator
perl -lne 'print length' test
0
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 167 total points
ID: 33425653
awk '{print length($0)}' test

"not counting the line terminator"
0
 
LVL 7

Assisted Solution

by:Murugesan Nagarajan
Murugesan Nagarajan earned 166 total points
ID: 33633951
Updated command using awk without counting the line terminator:

            awk '{print length}' test
or:
           awk '{print "Number of characters in the LINE"NR": "length}' test
0
 
LVL 7

Expert Comment

by:Murugesan Nagarajan
ID: 33633958
Example command using read:

while read NumberOfCharcters
do
echo ${#NumberOfCharcters}
done < test


0

Featured Post

Save on storage to protect fatherhood memories

You're the dad who has everything. This Father's Day, make sure your family memories are protected. My Passport Ultra has automatic backup and password protection to keep your cherished photos and videos safe. With up to 3TB, you have plenty of room to hold the adventures ahead.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now