标题: 求大神帮忙 [打印本页] 作者: 凉风真 时间: 2016-05-04 23:00 标题: 求大神帮忙 2. 使用for循环将下面这段话中所有字母长度超过5的单词打印出来。
“When you're attracted to someone it just means that your subconscious is attracted to their subconscious, subconsciously.
So what we think of as fate, is just two neuroses knowing they're a perfect match.”作者: ken.wlh 时间: 2016-05-23 09:19
#!/bin/sh
FILE="When you're attracted to someone it just means that your subconscious is attracted to their subconscious, subconsciously.So what we think of as fate, is just two neuroses knowing they're a perfect match"
NUM=`echo $FILE | wc -w`
for ((i=1;i<=$NUM;i++))
do
WORD=`echo $FILE | awk '{print $'$i'}'`
CNUM=`echo $WORD | wc -c`
if [ $CNUM -gt 6 ];
then
echo $WORD
fi
done 作者: 杰瑞26 时间: 2016-08-11 09:06 本帖最后由 杰瑞26 于 2016-08-11 09:10 编辑
#!/bin/bash
# filename: test.sh
sentence="When you're attracted to someone it just means that your subconscious is attracted to their subconscious, subconsciously.
So what we think of as fate, is just two neuroses knowing they're a perfect match."