computing
  • 0

Cut a Fixed Width In The File

  • 0

Hi,

I am below cut command:

cat test.txt | cut -c 1-320 > test_final.txt

This will cut till 320 width of each line. But i am not able to cut, if a line include an special characters(such as Ü,ç,ò,etc).

Please Help on this

Thanks
Umar

Share

1 Answer

  1. I didn’t test this, but in your shell, try setting noglob

    #!/bin/ksh

    set noglob

    cat test.txt | cut -c 1-320 > test_final.txt

    The Korn shell in cygwin cuts the characters without any problems.

    If those characters you posted are out of your data file, then you have a NULL character in your string. You’ll need to convert them to a space in order to solve your problem.

    • 0