Sponsored Content
Top Forums UNIX for Dummies Questions & Answers awk two lines with two checklist Post 302950630 by alvinoo on Monday 27th of July 2015 10:32:35 AM
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>

 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. 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

9. 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
RCP(1)							    BSD General Commands Manual 						    RCP(1)

NAME
rcp -- remote file copy SYNOPSIS
rcp [-px] file1 file2 rcp [-px] [-r] file ... directory DESCRIPTION
Rcp copies files between machines. Each file or directory argument is either a remote file name of the form ``rname@rhost:path'', or a local file name (containing no `:' characters, or a `/' before any `:'s). -r If any of the source files are directories, rcp copies each subtree rooted at that name; in this case the destination must be a direc- tory. -p The -p option causes rcp to attempt to preserve (duplicate) in its copies the modification times and modes of the source files, ignor- ing the umask. By default, the mode and owner of file2 are preserved if it already existed; otherwise the mode of the source file mod- ified by the umask(2) on the destination host is used. If path is not a full path name, it is interpreted relative to the login directory of the specified user ruser on rhost, or your current user name if no other remote user name is specified. A path on a remote host may be quoted (using , ", or ') so that the metacharacters are interpreted remotely. Rcp does not prompt for passwords; it performs remote execution via rsh(1), and requires the same authorization. Rcp handles third party copies, where neither source nor target files are on the current machine. SEE ALSO
cp(1), ftp(1), rsh(1), rlogin(1) HISTORY
The rcp command appeared in 4.2BSD. BUGS
Doesn't detect all cases where the target of a copy might be a file in cases where only a directory should be legal. Is confused by any output generated by commands in a .login, .profile, or .cshrc file on the remote host. The destination user and hostname may have to be specified as ``rhost.rname'' when the destination machine is running the 4.2BSD version of rcp. Linux NetKit (0.17) August 15, 1999 Linux NetKit (0.17)
All times are GMT -4. The time now is 10:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy