Solved

file line size

Posted on 2010-08-12
8
525 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
Comment Utility
no
perl -ne 'print length,"\n"' test
0
 
LVL 23

Expert Comment

by:Maciej S
Comment Utility
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
Comment Utility
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
Comment Utility
345 with "new line" character (344 without it). Yes.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 84

Expert Comment

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

Assisted Solution

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

"not counting the line terminator"
0
 
LVL 7

Assisted Solution

by:Murugesan Nagarajan
Murugesan Nagarajan earned 166 total points
Comment Utility
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
Comment Utility
Example command using read:

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


0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
When it comes to security, there are always trade-offs between security and convenience/ease of administration. This article examines some of the main pros and cons of using key authentication vs password authentication for hosting an SFTP server.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 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

8 Experts available now in Live!

Get 1:1 Help Now