Sort by

recency

|

54 Discussions

|

  • + 0 comments

    without tr command

    func() { local flag=1 local line="$1"

    for(( i=0 ; i<${#line}; i++ ))
    do
        char="`${line:$`i:1}"
        if [[ "$char" == ' ' ]]
        then
            if [[ $flag -eq 1 ]]
            then
                echo -n "$char"
                flag=0
            fi
        else
            echo -n "$char"
            flag=1
        fi
    done
    

    }

    while read -r line do func "$line" echo done

  • + 0 comments

    tr -s ' '

  • + 0 comments
    while read input; do 
        echo $input | tr -s " "
    done
    
  • + 0 comments
    #!/bin/bash
    while read line; do
        echo $line | tr " "* " "; done
    
  • + 0 comments
    while read input ; 
    do 
    
    echo ${input} >> output.txt 
    
    done 
    
    tr -d '"' '"' < output.txt