Remove First word of a sentence in shell

Hi there,

How I remove the first word of a sentence.

I have tried.

echo '1.1;'  ;     echo "$one" | grep '1.1 '    | awk '{print substr($0,index($0," ")+1)}'

For the below input.

1.1 Solaris 10 8/07 s10s_u4wos_12b SPARC

Just want to know if there is any shorter alternative.

Her is some solution. Some builtin and last one is using some external command, in this case cut.

# if using ksh:
x="1.1 2.2 3.3"
echo $x | read a b
echo "1:$a"

# all sh-shells
read a b c <<EOF
$(echo $x)
EOF
echo "2:$a"

Xdelim=" "
echo "3:${x%%${Xdelim}*}"

echo "4:"
echo $x | cut -d " " -f 1

I must be missing something here...

Calling 1.1 Solaris 10 8/07 s10s_u4wos_12b SPARC a sentence is stretching the term sentence way beyond it meaning in English.

For the given input, the simple solution is:

printf '1.1;\nSolaris 10 8/07 s10s_u4wos_12b SPARC\n'

For the general case, there is never any reason to pipe the output of grep into awk ; awk can easily do the work grep does without invoking both awk and grep .

Is there ever any reason to set a variable to a known string and then write commands to split that known string into substrings? If you know the components of your string; you know the substrings as well. Why not just set the substrings directly?

If your data is in a file, why are you splitting out lines from that file and echoing them into pipelines instead of just feeding the file directly into awk as an input operand?

This thread looks like someone is showing us a tree when we need to take a step backwards and look at the forest. What are you really trying to do here?

can't give

, the ";" is missing.
Wild guessing on your input variable, try

echo ${one/ /;}
1.1;Solaris 10 8/07 s10s_u4wos_12b SPARC

---------- Post updated at 11:57 ---------- Previous update was at 11:52 ----------

In case the one variable contains several lines, try

echo "$one" | awk '/1.1/ {$1=$1";"; print}'
1.1; Solaris 10 8/07 s10s_u4wos_12b SPARC