How to reduce the length of records in a file?

I have a file with 400 characters
How can I create another file with only a portion of them (like 300 within 400) and get rid of the rest?
Thanks

I would guess, about 500 different ways. Would be useful if you provided:

  • Platform
  • Shell
  • What's in the file
  • What do you want to extract

Provide us a sample input and the desire output, maybe we can help ^^

mon fichier contient des records paddes avec des blancs a la fin (longueur physique 400)
je veux supprimer les blancs a partir d'un certain offset de maniere a avoir des records de longueur physique 100 par example

Try...

 
awk '{$0=substr($0,1,300);print $0}' infile

Super it works! Thanks a lot.