Sponsored Content
Top Forums Shell Programming and Scripting Find the length of the longest line Post 302143752 by panknil on Saturday 3rd of November 2007 05:20:40 AM
Old 11-03-2007
Find the length of the longest line

Dear All,

To find the length of the longest line from a file i have used wc -L which is giving the proper output...

But the problem is AIX os does not support wc -L command.
so is there any other way 2 to find out the length of the longest line using awk or sed ?

Regards,
Pankaj
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

What the command to find out the record length of a fixed length file?

I want to find out the record length of a fixed length file? I forgot the command. Any body know? (9 Replies)
Discussion started by: tranq01
9 Replies

2. Shell Programming and Scripting

Shell script to find longest phrase

Hi Everyone, I am trying to write a shell script that can find the longest phrase that appears at least twice in an online news article. The HTML has been parsed through an HTML parser, converted to XML and the article content extracted. I have put this article content in a text file to work... (24 Replies)
Discussion started by: stargazerr
24 Replies

3. Shell Programming and Scripting

Bash script find longest line/lines in several files

Hello everyone... I need to find out, how to find longest line or possibly lines in several files which are arguments for script. The thing is, that I tried some possibilities before, but nothing worked correctly. Example when i use: awk ' { if ( length > L ) { L=length ;s=$0 } }END{ print... (23 Replies)
Discussion started by: 1tempus1
23 Replies

4. Shell Programming and Scripting

Find the length of each line in the file

Hi, I want to find the length of each line(including all the characters, spaces etc.) in a file and check if all the lines are of same length using a ksh script. Please help. Thanks in advance. (7 Replies)
Discussion started by: Suryaaravindh
7 Replies

5. Shell Programming and Scripting

Find longest string and print it

Hello all, I need to find the longest string in a select field and print that field. I have tried a few different methods and I always end up one step from where I need to be. Methods thus far: nawk '{if (length($1) > long) long=length($1); if(length($1)==long) print $1}' The above... (6 Replies)
Discussion started by: SEinT
6 Replies

6. UNIX for Dummies Questions & Answers

Display all the words whose length is equal to the longest word in the text

Hi Guys, I was going some trial and error to see if I can find the longest word in a text. I was using Pipes because they are easier to use in this case. I was stuck on this for a while so I thought I'll get some help with it. I tried this code to separate all the words in a text in... (4 Replies)
Discussion started by: bawse.c
4 Replies

7. Shell Programming and Scripting

Longest length of string in array

I would be grateful if someone could help me. I am trying to write a .sh script in UNIX. I have the following code; User=john User=james User=ian User=martin for x in ${User} do print ${#x} done This produces the following output; 4 5 3 6 (12 Replies)
Discussion started by: mmab
12 Replies

8. Shell Programming and Scripting

Finding the length of the longest column

Hi, I am trying to figure out how to get the length of the longest column in the entire file (because the length varies from one row to the other) I was doing this at first to check how many fields I have for the first row: awk '{print NF; exit}' file Now, I can do this: awk '{ if... (4 Replies)
Discussion started by: MIA651
4 Replies

9. Shell Programming and Scripting

wc -L giving incorrect length of longest line

Running below line gives 3957 as length of longest line in file 20121119_SRMNotes_init.dat awk ' { if ( length > 3950 ) { x = length } }END{ print x }' 20121119_SRMNotes_init.dat While wc -L 20121119_SRMNotes_init.dat gives output as 4329. Why is there a difference between these two commands.... (2 Replies)
Discussion started by: Satish Mantha
2 Replies
REPLMARKS(1)						      General Commands Manual						      REPLMARKS(1)

NAME
replmarks - replace triangular markers in a RADIANCE scene description SYNOPSIS
replmarks [ -e ][ -m newmod ][ -s scale ] { -x objfile | -i octree | -I mesh } modname .. [ file .. ] DESCRIPTION
Replmarks replaces triangular markers identified by the modifier modname in each scene description file and writes the result to the stan- dard output. The -x option indicates that each marker should be replaced by an appropriate xform(1) command on objfile. The -i option indicates that each marker should be replaced by an instance of octree. The -I option indicates that each marker should be replaced by an instance of the Radiance mesh mesh. One of these three options must appear on the command line, along with modname, the modifier used by markers in the file. Multiple modifiers may be given, as long as each one is preceded by its own -x or -i option. The transformation for each marker is determined by its location and orientation. A marker should be a right triangle pointing like a half-arrow in the direction of the transformed x-axis, x'. The longest side is the hypoteneuse, the second longest side is the x'-axis, and the third longest side indicates the direction of the y'-axis. Any additional sides will be ignored (ie. a quadrilateral may be used instead of a triangle if the extra side is small). The z'-axis is determined by the cross product of the x' and y' axes, and the origin is the common vertex between x' and y'. The size of the marker is ignored unless the -s option is used, where scale is a multiplier for the x'-axis length to indicate the total scale factor. For example, a scale value of 5 with a marker length of .5 would result in a total scale factor of 2.5 to be used in the transformation. The -e option causes commands in the file to be expanded, and is required to replace markers from commands in the input file. Even with this option, replmarks will not examine objects for markers. Specifically, an object included by replmarks as a result of a -x expansion will be transferred verbatim, without regard to any surfaces therein that might have been considered as marks if they were on the main input. The -m option causes all replaced objects to be given the modifier newmod. Otherwise, the new object surfaces will use their originally defined modifiers. A different replacement modifier may be given for each marker type. The marker modifier name itself is only used to identify markers, and will not appear in the output in any form. If no input file is given, the standard input is read. EXAMPLE
To replace all polygons with the modifier ``knobs'' in the file input with a transformed ``knob.rad'' and write the result to output: replmarks -x knob.rad knobs input > output To use instances of ``tree.oct'' with scaling set to three times the tree marker length: replmarks -s 3 -i tree.oct tree input > output AUTHOR
Greg Ward SEE ALSO
arch2rad(1), ies2rad(1), xform(1) RADIANCE
3/24/94 REPLMARKS(1)
All times are GMT -4. The time now is 08:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy