Sort by

recency

|

92 Discussions

|

  • + 0 comments
    counter=0
    while read -r line;do
        counter=$((counter+1))
        if [ $counter == 4 ];then
            echo "$line"
            break
        fi
        
    done
    
  • + 1 comment
    awk 'NR==4 {print}'
    
  • + 1 comment
    readarray array
    echo ${array[3]}
    
    readarray array
    echo ${array[@]:3:1}
    
  • + 0 comments
    country=()
    while read line; do 
    country+=($line)
    done
    echo ${country[3]}
    
  • + 0 comments
    arr=()
    while read line; do arr+=($line); done
    echo ${arr[3]}
    

    without using Array:

    for ((i=0;i<=3;i++)); do read line; done
    echo $line