Sponsored Content
Top Forums Shell Programming and Scripting awk - help in removing some text Post 302998462 by dakelly on Friday 2nd of June 2017 05:34:50 AM
Old 06-02-2017
awk - help in removing some text

Hey Guys,

Earlier I asked a question under Solaris, which I got great help... thanks.

Although I got the script working for what it really needed to do, I am looking for a bit of help to change the output for nicer reading.

my script gets a list of zones under a global-zone and puts this to a text file e.g
/newpool/server1
/testpool/server2
Code:
###  get the zone admin list
zoneadm list -iv | awk '{ print $4 }' | awk ' length>3 ' | grep -v "PATH" | sort >> $ZONES

in a while loop I output the zones and then show, under root, what reboots have been set up (to see if any have been hashed out)

in my loop I echo the zone appending another text file
Code:
while read ZONE
do
    echo "$ZONE"  >> $MSG
    echo "--------------------------------------" >> $MSG
    cat $ZONE/root/var/spool/cron/crontabs/root | grep "/shutdown" >> $MSG
    echo "\n" >> $MSG
done < "$ZONES"

I want to change the output of echo "$ZONE >> $MSG to remove "/pooltype/" and only echo out the server name.

I have tried adding grep - "/*/" or "\/\*\/" but this works but either does not show any server ("/*/") or shows the server with pool ("\/\*\/")

But I am thinking AWK might be better for what I am trying to do but I can't find anything with awk on how to do this, can anyone suggest how to do this?

I have never used sed so don't know anything about that.

thanks in advance

davy
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

removing commas from text file

Dear all I have a file which looks like this xxxxxxxxxxxxxx,xxx,xxxxxxxxxx xxxxxxxxxxxxxx,xxx,xxxxxxxxxx etc basically 14 characters then a comma, three characters, then a comma then 10 characters. We are uploading this file to our mainframe and they want the commas removed, so it... (6 Replies)
Discussion started by: hcclnoodles
6 Replies

2. Shell Programming and Scripting

Removing lines in a text file.

Here is my problem I'm hoping you guru's can help me figure out. I have a text file that contains comma delimited columns. What I'm looking to do is see if the 24th column on each row in the file contains a value (not null), and then write/append that line to a different file. I've been... (4 Replies)
Discussion started by: WABonnett
4 Replies

3. Shell Programming and Scripting

Removing matching text

Hello Everyone! Of course I am rather new to these forums, but I have been browsing the forums for awhile, always has a lot of useful information :) This time however, I can not find the information I need, well, not completely. So here is the problem, I am a linux admin (dealing mostly with... (1 Reply)
Discussion started by: Rhije
1 Replies

4. Shell Programming and Scripting

Removing text between two static strings

Hi everyone, I need to replace the text between two strings (html tags) and I'm having trouble figuring out how to do so. I can display the text with sed but I'm not having any luck deleting the text between the two strings. My file looks like this: <oths>test</oths><div class="text">1928... (2 Replies)
Discussion started by: cg2
2 Replies

5. Shell Programming and Scripting

Help with removing line from text

Hey everyone, I kinda new to shell programming and learning bits and pieces of stuff from tutorials. I got this problem, where I asked my user to enter a string, which will delete a specific line in the string, which I'm unable to do it. Text file(BookDB.txt) as shown: Three Little... (4 Replies)
Discussion started by: aLHaNz
4 Replies

6. Shell Programming and Scripting

Removing zero values from text file

Hi all, I wrote the following code to remove the value which are 0 in the input file (a columns if numbers). awk 'BEGIN { for (i=1; i<=NF; i++) if ($i) printf("%13.6e\n",$i) }' $1 >> $2 The script works if the zeros are written as 0.0000 but not as 0.000000e+00 In... (10 Replies)
Discussion started by: f_o_555
10 Replies

7. Shell Programming and Scripting

removing lines without text

How do I remove line that do not contain text, but that do contain tabs? I have tried the command cat file | awk NF but that doesn't work when the lines contain tabs (and spaces). I have also tried: cat file | sed '/^$/d' (9 Replies)
Discussion started by: locoroco
9 Replies

8. Shell Programming and Scripting

Removing " from a text using awk

I was testing some and from this string try to remove all ", but not \" cat file The quick brown fox "jumps", over the 'lazy \"dog\"' result requested: The quick brown fox jumps, over the 'lazy \"dog\"' I have seen a working solution for sed, but I like awk :) This code seem to work,... (19 Replies)
Discussion started by: Jotne
19 Replies

9. UNIX for Dummies Questions & Answers

Removing PATTERN from txt without removing lines and general text formatting

Hi Everybody! First post! Totally noobie. I'm using the terminal to read a poorly formatted book. The text file contains, in the middle of paragraphs, hyphenation to split words that are supposed to be on multiple pages. It looks ve -- ry much like this. I was hoping to use grep -v " -- "... (5 Replies)
Discussion started by: AxeHandle
5 Replies

10. UNIX for Dummies Questions & Answers

Removing \n from a text file

Hi All, I have a question regarding text substitution. I have a file that contains a lot of text. Some of the text is separated with a \n like: TEST\nTEST2\nTEST3 BLA\nBLA2\nBLA3 So there are both actual newlines and 'used to be newlines' in the text. using tr tr "\n" "," or... (5 Replies)
Discussion started by: JaapSchuurman
5 Replies
PDNSSEC(8)						      System Manager's Manual							PDNSSEC(8)

NAME
pdnssec - PowerDNSSEC command and control SYNOPSIS
pdnssec [options] command DESCRIPTION
pdnssec is a powerful command that is the operator-friendly gateway into PowerDNSSEC configuration. Behind the scenes, pdnssec manipulates a PowerDNS backend database, which also means that for many databases, pdnssec can be run remotely, and can configure key material on dif- ferent servers. OPTIONS
A summary of options is included below. -h [ --help ] Show summary of options. -v [ --verbose ] Be more verbose. --force force an action --config-name arg Virtual configuration name --config-dir arg (=/etc/powerdns) Location of pdns.conf --commands arg Commands given as an argument COMMANDS
activate-zone-key ZONE KEY-ID Activate a key with id KEY-ID within a zone called ZONE. add-zone-key ZONE [zsk|ksk] [bits] [rsasha1|rsasha256|rsasha512|gost|ecdsa256|ecdsa384] Create a new key for zone ZONE, and make it a KSK or a ZSK, with the specified algorithm. check-zone ZONE Check a zone for correctness deactivate-zone-key ZONE KEY-ID Deactivate a key with id KEY-ID within a zone called ZONE. disable-dnssec ZONE Deactivate all keys and unset PRESIGNED in ZONE export-zone-dnskey ZONE KEY-ID Export to standard output DNSKEY and DS of key with key id KEY-ID within zone called ZONE. export-zone-key ZONE KEY-ID Export to standard output full (private) key with key id KEY-ID within zone called ZONE. The format used is compatible with BIND and NSD/LDNS. hash-zone-record ZONE RNAME This convenience command hashes the name 'recordname' according to the NSEC3 settings of ZONE. Refuses to hash for zones with no NSEC3 settings. import-zone-key ZONE FILE [ksk|zsk] Import from 'filename' a full (private) key for zone called ZONE. The format used is compatible with BIND and NSD/LDNS. KSK or ZSK specifies the flags this key should have on import. rectify-zone ZONE Calculates the 'ordername' and 'auth' fields for a zone called ZONE so they comply with DNSSEC settings. Can be used to fix up migrated data. Can always safely be run, it does no harm. remove-zone-key ZONE KEY-ID Remove a key with id KEY-ID from a zone called ZONE. secure-zone ZONE Configures a zone called ZONE with reasonable DNSSEC settings. You should manually run 'pdnssec rectify-zone' afterwards. set-nsec3 ZONE 'params' [narrow] Sets NSEC3 parameters for this zone. A sample commandline is: "pdnssec set-nsec3 powerdnssec.org '1 1 1 ab' narrow". The NSEC3 parameters must be quoted on the command line. WARNING: If running in RSASHA1 mode (algorithm 5 or 7), switching from NSEC to NSEC3 will require a DS update at the parent zone! set-presigned ZONE Switches zone to presigned operation, utilizing in-zone RRSIGs. show-zone ZONE Shows all DNSSEC related settings of a zone called ZONE. unset-nsec3 ZONE Converts a zone to NSEC operations. WARNING: If running in RSASHA1 mode (algorithm 5 or 7), switching from NSEC to NSEC3 will require a DS update at the parent zone! unset-presigned ZONE Disables presigned operation for ZONE. AUTHOR
This manual page was written by Matthijs Mohlmann <matthijs@cacholong.nl> for the Debian Project (but may be used by others) SEE ALSO
pdns_server(8),pdns_control(8) PowerDNS November 2011 PDNSSEC(8)
All times are GMT -4. The time now is 04:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy