-2

Suppose I have a text file with a lot of data. Using Shell Scripting, while reading the file if I get the keyword "CURRENT" it will copy the data to another file until it is getting the keyword "END-0".

Not able to develop the script snippet for this.

Sushovon
  • 21
  • 4

1 Answers1

0

You probably want to look at awk or sed for this task.

# Using SED
sed -n '/CURRENT/,/END-0/p' input-file >another-file

# Using AWK
awk '/CURRENT/,/END-0/' input-file >another-file

dash-o
  • 13,723
  • 1
  • 10
  • 37