0

my input file where text is ---- file name--test

1 Proposal 1 <96> Election of Directors
2 24 AAR
3 Compensation Committee
4 Chair
5 Ronald B. Woodard
6 Members
7 Anthony K. Anderson
8 Norman R. Bobins
9 Michael R. Boyce
10 Peter Pace
11 Jennifer L. Vogel
12 Role and Responsibilities
13 The Compensation Committee is comprised entirely of independent
14 directors qualified to serve on the Compensation Committee under
15 applicable SEC and NYSE rules and the Company<92>s Categorical Standards
16 for Determining Director Independence.
17 The Compensation Committee acts under a written charter adopted by
18 the Board of Directors. The charter was last reviewed and approved by the
19 Compensation Committee and the Board of Directors at their July 2019
20 meetings. The full text of the Compensation Committee charter appears
21 on the Company<92>s website and is available in print to any stockholder upon
22 written request to the Secretary of the Company at the Company<92>s address
23 listed on the first page of this proxy statement.
24 The Compensation Committee is primarily concerned with establishing,
25 reviewing and approving Chief Executive Officer compensation, reviewing
26 and approving other senior executive compensation and overseeing the
27 Company<92>s stock plans and other executive compensation and employee
28 benefit plans. The Compensation Committee performs the specific
29 functions described in its charter, including:
30 <95> Sets the compensation of the Chief Executive Officer and, together
31 with the Nominating and Governance Committee, conducts an annual
32 performance review of the Chief Executive Officer;
33 <95> Reviews and approves compensation policies and practices for all
34 elected corporate officers, including named executive officers;
35 <95> Administers the Company<92>s annual cash bonus plan and the long-term
36 incentive stock plan;

------ keyword file is----- file name--- [words]

   Compensation
   we

------- my code is

     while read "p"; do


    while read -r line ; do
    paste  -d',' <(echo -n  "$p" ) <(echo "searchall") <(  grep -i -w "$p" test | wc -l)  <( 
    echo "$line" )

    done < <(grep --color=always -w -i -C1 "$p" test)


                                                                                                                                       


    done <words
  

----------my expectation ,output should be

                                  line above it
       keyword,serchall,frequency,line it find keyword in
                                  line below  it
     
                               24 AAR
     Compensation,searchall,13,Compensation Committee
                               Chair

                               Role and Responsibilities
     Compensation,searchall,13,The Compensation Committee is comprised entirely of   independent                        
                               directors qualified to serve on the Compensation Committee under 


                               The Compensation Committee is comprised entirely of   independent                          
     Compensation,searchall,13,directors qualified to serve on the Compensation Committee under 
                              applicable SEC and NYSE rules and the Company<92>s Categorical Standards

-------- coming output from the code above

Compensation,searchall,13,24 AAR
Compensation,searchall,13,Compensation Committee
Compensation,searchall,13,Chair
Compensation,searchall,13,--
Compensation,searchall,13,Role and Responsibilities
Compensation,searchall,13,The Compensation Committee is comprised entirely of independent
Compensation,searchall,13,directors qualified to serve on the Compensation Committee under
Compensation,searchall,13,applicable SEC and NYSE rules and the Company<92>s Categorical 
 Standards
 

q1--- how can i remove these unwanted strings using awk,sed ,grep or looping to get the desired output

q2 --- in the line 13 and line 14 the keyword "Compensation" is coming so how to solve this issue to get the desired output so that i can get line above and below for both lines 13 and 14 as shown is expected output

NOTE

          --- please mention the comments in the code how it is working , some explanation or reference 
         ---- please keep the code simple as simple as layman language 
          ---- if you are using awk   to solve the entire program , please mention the comments and the reference        
  
  • 1
    Welcome to SO and special thanks for showing your efforts in form of code. Could you please fix your samples spaces if those are not really present on your sample Input_file, kindly do edit your post and let us know then. – RavinderSingh13 Aug 19 '20 at 07:44
  • @RavinderSingh13 this is the exact file i want to perform my actions , i have opened this file in the VIM and did [se nu ] to show the line numbers . only these line numbers are not present in the input_file . – Aditya Singh Aug 19 '20 at 08:06

0 Answers0