#!/bin/bash awk -F "." '{a[NR]="yes";for(i=1;i<=NF;i++){if(NF==4){if($i>255 || $i<0){a[NR]="no"}}else{a[NR]="error"}}; print a[NR]}' nowcoder.txt