Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 540
  • Last Modified:

file line size

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
Sara_j_11
Asked:
Sara_j_11
  • 2
  • 2
  • 2
  • +2
3 Solutions
 
ozoCommented:
no
perl -ne 'print length,"\n"' test
0
 
Maciej SsysadminCommented:
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
 
Sara_j_11Author Commented:
wehn i execute it I get the result:
as
345
345
345
345
345


does that mean that line size is 345?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Maciej SsysadminCommented:
345 with "new line" character (344 without it). Yes.
0
 
ozoCommented:
not counting the line terminator
perl -lne 'print length' test
0
 
woolmilkporcCommented:
awk '{print length($0)}' test

"not counting the line terminator"
0
 
Murugesan NagarajanSubject-matter expert at delivery, implementation, and automation at UNIX oriented operating systems (Windows: CYGWIN_NT MINGW32_NT MINGW64_NT)Commented:
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
 
Murugesan NagarajanSubject-matter expert at delivery, implementation, and automation at UNIX oriented operating systems (Windows: CYGWIN_NT MINGW32_NT MINGW64_NT)Commented:
Example command using read:

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


0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now