awk two lines with two checklist


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers awk two lines with two checklist
# 1  
Old 07-27-2015
awk two lines with two checklist

Hi there,

I am trying to get two lines of the checklist

Code:
2.3;
2.4;
2.5;


Code:
$file='Input1 Input2'
echo -e "2.3 Only enable ftp when necessary"
cat $file | awk '/2.4/ {P=0} /2.3/ {P=1} P' | grep -iq "not installed" && echo T || echo F
echo -e "2.4 Only enable rlogin/rsh/rcp when necessary"
cat $file | awk '/2.5/ {P=0} /2.4/ {P=1} P' | grep -iq 'rlogin.*rsh.*rcp' && echo T || echo F # and condition

Input1
Code:
2.3 Only enable ftp when necessary
package vsftpd is not installed
2.4 Only enable rlogin/rsh/rcp when necessary
package rlogin is not installed
package rsh is not installed
package rcp is not installed

Input2
Code:
2.3 Only enable ftp when necessary
package vsftpd is not installed
2.4 Only enable rlogin/rsh/rcp when necessary
package rlogin is not installed
package rsh is not installed
package rcp is not installed

My expected output is the following, there may be more than one input at any point in time.

Code:
<tr><td>2.3<td>Output1:Only enable ftp when necessary
package vsftpd is not installed<br>Output2:Only enable ftp when necessary
package vsftpd is not installed</td></tr>

 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Combine 2 Outputs with a single Checklist

Checklist 1.1; Contains Solaris 1.2; Contains Patches 1.3; <no output> 1.3.1; <no output> Output1 1.1 Solaris 10 8/07 s10s_u4wos_12b SPARC 1.2 Patch: 127714-03 Obsoletes: Requires: 120011-14 Incompatibles: Packages: SUNWsshcu, SUNWsshdu, SUNWsshu Patch: 128253-01 Obsoletes:... (5 Replies)
Discussion started by: alvinoo
5 Replies

2. Red Hat

Rhel upgrade - pre maintenance checklist

I going to be updating a few of our rhel5.5 servers this weekend to rhel5.10. I'll be making a checklist for pre & post maintenance comparisions. so far I'll be checking, services running filesystems netstat ifconfig uname oracleasm multipath just basic stuff if it were you what... (5 Replies)
Discussion started by: mkeyes001
5 Replies

3. AIX

AIX Production Readiness Checklist (PRC) - check list

Hello Everyone, Can anyone please provide me the checklist for validating our newly built AIX LPARs. AIX is new in our environment. So I'm looking for a reference document or checklist to verify new LPARs. I believe most of the companies does have some kind of check list to verify. please... (4 Replies)
Discussion started by: System Admin 77
4 Replies

4. OS X (Apple)

Creating Shell Script for STIG Checklist MAC OSX 10.6

Hello, I am new to Mac OSX and shell scripting all together. I was wondering if anyone could help get me started in a few scenarios so that I would be able to automate checking a system against a STIG checklist. A STIG Checklist is a DoD Guideline for securing systems. Here is the first... (3 Replies)
Discussion started by: john3j04
3 Replies

5. Shell Programming and Scripting

[Bash] Checklist

Hello! What is the script for a checklist? This: dialog --backtitle "Mesage" \ --title "Title" \ --checklist "Choose your favorite distribution:" 10 40 3 1 "RedHat" on 2 "Ubuntu Linux" off 3 "Slackware" off ??? I need help! (0 Replies)
Discussion started by: []Adri4n
0 Replies

6. Shell Programming and Scripting

Determine number of checklist in zenity dynamically...

Hi, In my Shell Script i am counting the duplicate IPs in LAN,...After counting i have to show in checklist in zenity which one to delete from the LAN........so initially i dont know no. of duplicate IPs in the LAN....Hence i can determine how many check list needed..... Duplicate IPs... (3 Replies)
Discussion started by: shivarajM
3 Replies

7. Shell Programming and Scripting

Checklist for Shell Script reqd

Hi, Can anyone provide me with the Code Review Checklist for Shell scripts ?? Thanks in advance. (2 Replies)
Discussion started by: Shivdatta
2 Replies

8. Solaris

Checklist on Preventive Maintenance

Hi all, I'm a new SUN Engineer and will be doing some Preventive Maintenance next month. What should I do? Is there any standard procedure to be followed? Thank You (4 Replies)
Discussion started by: frankoko
4 Replies

9. HP-UX

whats diff. B/W /etc/checklist & /etc/fstabs

hi all, I juz want to know y tr r 2 files of same content present... is tr any sp. reason s der. b/w /etc/checklist & /etc/fstab (1 Reply)
Discussion started by: rrlog
1 Replies
Login or Register to Ask a Question