Dear gurus,
Please help this beginner to write and understand the required script. I am looking for useing awk for sed.
I have a few thousand lines file whose contain are mostly as below and I am trying to achieve followings.
- Find a string, say user1. Then hash the line containing the string along with 2 lines before and 1 line after.
- The script should not hast other lines like user10,11,12 etc.
The file looks like as below.
start {
UID 5001
NAME user1
}
start {
UID 5002
NAME user2
}
start {
UID 5003
NAME user3
}
start {
UID 5004
NAME user4
}
start {
UID 5005
NAME user5
}
start {
UID 5006
NAME user6
}
start {
UID 5007
NAME user7
}
start {
UID 5008
NAME user8
}
start {
UID 5009
NAME user9
}
start {
UID 5010
NAME user10
}
start {
UID 5011
NAME user11
}
start {
UID 5012
NAME user12
}
start {
UID 5013
NAME user13
}
start {
UID 5014
NAME user14
}
start {
UID 5015
NAME user15
}
start {
UID 5016
NAME user16
}
start {
UID 5017
NAME user17
}
start {
UID 5018
NAME user18
}
start {
UID 5019
NAME user19
}
start {
UID 5020
NAME user20
}
Thanks in advance
Randy