私はプログラミングの割り当ての紹介に取り組んでいる新しいバイオテクノロジーの学生です、私はレンガの壁にぶつかりました。質問は次のとおりです。
"(3)新しい「.bashrc1」ファイルで、各行のスペースで区切られた2番目のエントリの中に0 ... 9の数字が含まれているものはいくつありますか?新しいファイル「.bashrc1.counts」に回答をパイプしてください。 「number、count ...」(例:0、12 ...)の形式で。
私がこれまでにやったことは
more .bashrc1 | awk ‘{print $2}’ | grep –c “0..9” > .bashrc1.counts
grepの部分がおそらく間違っていることは知っていますが、範囲を渡す方法はありますか?お気に入り
grep -c "0","1"... etc
または私はしなければなりませんか
|grep -c "0"|grep -c "1"|
また、ファイルに出力する方法はわかりますが、世界でどのように出力をそのような方法でフォーマットするのですか?グーグルと講義ノートを使い果たしましたが、問題に関連する情報が見つからないようです。
編集:私がgrepしているファイル; エイリアスが1つ追加されたデフォルトの.bashrcファイルのコピーです。
# Sample .bashrc for SuSE Linux
# Copyright (c) SuSE GmbH Nuernberg
# There are 3 different types of shells in bash: the login shell, normal shell
# and interactive shell. Login shells read ~/.profile and interactive shells
# read ~/.bashrc; in our setup, /etc/profile sources ~/.bashrc - thus all
# settings made here will also take effect in a login shell.
#
# NOTE: It is recommended to make language settings in ~/.profile rather than
# here, since multilingual X sessions would not work properly if LANG is over-
# ridden in every subshell.
# Some applications read the EDITOR variable to determine your favourite text
# editor. So uncomment the line below and enter the editor of your choice :-)
#export EDITOR=/usr/bin/vim
#export EDITOR=/usr/bin/mcedit
# For some news readers it makes sense to specify the NEWSSERVER variable here
#export NEWSSERVER=your.news.server
# If you want to use a Palm device with Linux, uncomment the two lines below.
# For some (older) Palm Pilots, you might need to set a lower baud rate
# e.g. 57600 or 38400; lowest is 9600 (very slow!)
#
#export PILOTPORT=/dev/pilot
#export PILOTRATE=115200
test -s ~/.alias && . ~/.alias || true
alias start = "ls ~"