Dear All
From below mention input file I want op file as mention. Kindly help.
IP file:
"BSCGNR4_IPA17_C" 329 140119 0717 RXOCF-105 KJO001_BASC_NG AC FAULTY DG ON DOOR OPEN
Needed OP:
140119 0717 KJO001_BASC_NG AC FAULTY DG ON DOOR OPEN
Note that string mark in red as variable in length. IE no of alarm may be vary.
THANKS.
Regards
Jaydeep
Try:
awk '{printf $3" "$4" "$6" "; for (i=7;i<=NF;i++) printf $i" ";printf "\n"}' input
OR try this
$ echo '"BSCGNR4_IPA17_C" 329 140119 0717 RXOCF-105 KJO001_BASC_NG AC FAULTY DG ON DOOR OPEN' | \
awk '{$1 = $2 = $5 = ""; $0 = $0; $1 = $1}1'
140119 0717 KJO001_BASC_NG AC FAULTY DG ON DOOR OPEN
use following with your input file
$ awk '{$1 = $2 = $5 = ""; $0 = $0; $1 = $1}1' file
This might then work too:
awk 'sub(".*" $5, $3 FS $4)' file
@OP: Do you know what is the format of the file? How are the fields separated?