Sponsored Content
Top Forums Shell Programming and Scripting Need assistance with an IF statement to compare a list of SHA keys between two repositories. Post 303035802 by Chubler_XL on Monday 3rd of June 2019 05:02:46 PM
Old 06-03-2019
You could use awk like this:

Code:
awk '
  FNR==1 { file++ }
  /^Package: / { p = substr($0,10) }
  /^Version: / { v = substr($0,10) }
  /^SHA256: / {
      c = substr($0, 9)
      if(file==1) C[c]
      else if(!(c in C))
        printf "Package: %s (%s) SHA256 %s not found in repo\n", p, v, c
}' <(curl [repo-file]) [address-of-local-repo-file]

This User Gave Thanks to Chubler_XL For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Very urgent :- How to compare string using if statement

Hi How can i compare a string using if statement in a script? For eg: I have filename="abc.sh" if ;then { ....... ....... } fi but this doesnot work .. How will i execute this ?? Thanks in advance (1 Reply)
Discussion started by: jisha
1 Replies

2. Shell Programming and Scripting

AWK statement formatting assistance

I am writing a script that ssh's out to our various servers and extracts diskspace info to generate into a report. With the mix of servers linux/solairs 8-10/AIX the easiest way is to use df -k (though I much rather prefer df -h). I have pasted the relevant code: dfdata=`ssh -q -o... (1 Reply)
Discussion started by: rkruck
1 Replies

3. Shell Programming and Scripting

Compare files column to column based on keys

Here is my situation. I need to compare two tab separated files (diff is not useful since there could be known difference between files). I have found similar posts , but not fully matching.I was thinking of writing a shell script using cut and grep and while loop but after going thru posts it... (2 Replies)
Discussion started by: blackjack101
2 Replies

4. Shell Programming and Scripting

awk if statement to evaluate string and compare

I have the following simplified code that I am planning on putting into a larger shell script. I have been butchering it to try and make work amongst google searches and reading awk documentation. amixer sset Master toggle | awk '{ if ( /^ Front Left/ { print $7 } == // ) print "MUTED" }'I... (2 Replies)
Discussion started by: jelloir
2 Replies

5. Debian

Repositories in sources.list

I'm just interested to know how your sources.list look like. I got some repositories witch give some errors and I would like to clean it up. and when I do apt-get update I get few lines showing errors like 404 , this is how my list look like: # deb cdrom:/ squeeze main # deb cdrom:/... (0 Replies)
Discussion started by: zdorian
0 Replies

6. Linux

Convert MD5 password to SHA-512?

Hi, Is it possible to convert MD5 passwords to SHA-512? I'm about to migrate an old slackware server to Debian, then I noticed that they don't use same encryption method. I'm aware that I can change the encryption method in Debian to MD5, but as far as I understand SHA-512 is more secure,... (2 Replies)
Discussion started by: urandom
2 Replies

7. Shell Programming and Scripting

Compare strings with space in if statement

DEV> vi test_if_statement.sh "test_if_statement.sh" 9 lines, 205 characters proc_out="Normal completion" proc_out_comp="Normal completion" echo 'proc_out:'$proc_out echo 'proc_out_comp:'$proc_out_comp if then echo 'match' else echo 'no_match' fi ~ ~ ~ ~ ~ ~ ~ ~ ~ (4 Replies)
Discussion started by: cartrider
4 Replies

8. UNIX and Linux Applications

How to make ldappasswd use {SHA} instead of {SSHA} for users passwords in openldap?

Is it possible to use {SHA} with ldappasswd? I didn't find responsible option in manual page and doc (1 Reply)
Discussion started by: urello
1 Replies

9. AIX

SHA-256-Base 64 Encryption

Hello Guys, I was trying to have an SHA256 encryption which further be encrypted into base 64 using AIX unix command shasum -a 256. What I found in this is my output is different than a website: "online-convertcom" Actually conversion from website is exactly matching my requirements but... (4 Replies)
Discussion started by: Krunal Patel
4 Replies

10. UNIX for Beginners Questions & Answers

If statement to compare two strings

Hi, I am trying to do the following to see if "ip" is already present in a file. if ; then echo "hi" else echo "hello" fi I am seeing errors on the if statement. Can someone please correct the syntax for me? Thanks (2 Replies)
Discussion started by: waince
2 Replies
ntp.keys(5)							   File Formats 						       ntp.keys(5)

NAME
ntp.keys - NTP symmetric key file format configuration file SYNOPSIS
[--option-name] [--option-name value] All arguments must be options. DESCRIPTION
This document describes the format of an NTP symmetric key file. For a description of the use of this type of file, see the "Authentica- tion Support" section of the ntp.conf(5) page. ntpd(8) reads its keys from a file specified using the -k command line option or the keys statement in the configuration file. While key number 0 is fixed by the NTP standard (as 56 zero bits) and may not be changed, one or more keys numbered between 1 and 65535 may be arbi- trarily set in the keys file. The key file uses the same comment conventions as the configuration file. Key entries use a fixed format of the form keyno type key opt_IP_list where keyno is a positive integer (between 1 and 65535), type is the message digest algorithm, key is the key itself, and opt_IP_list is an optional comma-separated list of IPs where the keyno should be trusted. that are allowed to serve time. Each IP in opt_IP_list may con- tain an optional /subnetbits specification which identifies the number of bits for the desired subnet of trust. If opt_IP_list is empty, any properly-authenticated message will be accepted. The key may be given in a format controlled by the type field. The type MD5 is always supported. If ntpd was built with the OpenSSL library then any digest library supported by that library may be specified. However, if compliance with FIPS 140-2 is required the type must be either SHA or SHA1. What follows are some key types, and corresponding formats: MD5 The key is 1 to 16 printable characters terminated by an EOL, whitespace, or a # (which is the "start of comment" character). SHA SHA1 RMD160 The key is a hex-encoded ASCII string of 40 characters, which is truncated as necessary. Note that the keys used by the ntpq(8) and ntpdc(8) programs are checked against passwords requested by the programs and entered by hand, so it is generally appropriate to specify these keys in ASCII format. FILES
/etc/ntp.keys the default name of the configuration file SEE ALSO
ntp.conf(5), ntpd(1), ntpdate(1), ntpdc(1), sntp(1) AUTHORS
The University of Delaware and Network Time Foundation COPYRIGHT
Copyright (C) 1992-2017 The University of Delaware and Network Time Foundation all rights reserved. This program is released under the terms of the NTP license, <http://ntp.org/license>. BUGS
Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org NOTES
This document was derived from FreeBSD. This manual page was AutoGen-erated from the ntp.keys option definitions. 4.2.8p13 20 Feb 2019 ntp.keys(5)
All times are GMT -4. The time now is 05:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy