ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

How to read up to 1st 256 characters of IFS file in QSH, head can't count characters

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to read up to 1st 256 characters of IFS file in QSH, head can't count characters

    The head command only counts lines in qsh. The file can be 200 bytes up to 50 megabytes (EDI files) and some don't have any carriage return or line feed characters, so counting lines appears to exceed limits.

    head -n 3 filename.EDI | grep GS*PD*

    there is no option for character count in the qsh version of head most Linux books show

    head -c 512 filename.EDI | grep GS*PD*

    I just need to look for a particular string "GS*PD*" in the first 256 bytes. I was going to use grep to look for it, but don't want to read 50 megabytes just to look in the first few characters for a string.

    Any ideas?

  • #2
    Though Qshell head doesn't count characters, PASE head does.
    Tom

    There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

    Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

    Comment


    • #3
      Thanks, I found that was on the system. I'll have to look for a manual. I found a list of commands, but no manual. I wrote a C program on the iSeries and was able to compile it, but don't know how to run it from qsh.

      Comment

      Working...
      X