It is currently Tue, 17 May 2022 02:59:15 GMT



 
Author Message
 how to truncate lines to a specific length?
I have a file with variable line lenghts which I want to truncate up to a
maximum size, i.e. line length.
How can it be done?
How can I get the maximum line size in a file?

Any help would be appreciated,
Roman



 Sat, 03 Aug 2002 03:00:00 GMT   
 how to truncate lines to a specific length?
In article <Gwdq4.478$UJ4.318663@news>,

You can use cut to do this:

cut -c 1-20 infile > outfile

will output the first 20 characters per line to outfile.

man cut

Chuck Demas
Needham, Mass.

--
  Eat Healthy    |   _ _   | Nothing would be done at all,
  Stay Fit       |   @ @   | If a man waited to do it so well,
  Die Anyway     |    v    | That no one could find fault with it.
  de...@tiac.net |  \___/  | http://www.tiac.net/users/demas



 Sat, 03 Aug 2002 03:00:00 GMT   
 how to truncate lines to a specific length?

man cut

With GNU wc: wc -L file
Portably:    awk 'length > max { max=length } END {print max}'

                --Ken Pizzini



 Sun, 04 Aug 2002 03:00:00 GMT   
 
   [ 3 post ] 

Similar Threads

1. sed expression for truncating line length

2. SED / Line / (Need to get data from searched line from specific char to char)

3. Process Command Line Truncated

4. /usr/ucb/ps auxww truncates lines at 140 chars

5. /bin/ps truncates command lines


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software