[완료]cat이나 strings에서

znfznfzz의 이미지

만약 내용이 1234일때
12나 123만 출력할 수는 없나요?...

셸스크립트중 if문을 쓰는데 좀 필요해서요...

znfznfzz의 이미지

참고로 연속된 글자입니다...
awk나 cut등으로는 못할듯 ㅋ

라키시스의 이미지

#!/bin/bash
THIS='12345'
THAT=${THIS:0:3}
echo ${THAT}
^D

man bash 해서 죽~~ 넘기다 보면 이런것이 나옵니다...

${parameter:offset:length}
   Substring Expansion.  Expands to up to length characters of parameter starting at the character specified by  off-
   set.   If  length is omitted, expands to the substring of parameter starting at the character specified by offset.
   length and offset are arithme.... 
znfznfzz의 이미지

앗..감사합니다