Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
UNIX でテキスト ファイルの最初の文字をどのように出力/取得するのか疑問に思っていました。
つまり、「9 textfile.txt」は 9 を返すと言います。
どうも
headファイルの最初の文字を取得するために使用できます。
head
head -c 1 file.txt
すべての行の最初の文字が必要な場合:
grep -o ^. file.txt
または
cut -c 1 file.txt