Sponsored Content
Full Discussion: Hostsfile generator
Top Forums Shell Programming and Scripting Hostsfile generator Post 303041004 by RudiC on Tuesday 12th of November 2019 04:57:16 AM
Old 11-12-2019
Hmmm - I missed to post the necessary IFS modification. Try again with this slightly modified version:
Code:
IFS=$'\n'

for IN in $(echo "${!ENTRIES[*]}" | tr ',' '\n' | sort -un)
  do    [ ! "${IN/[A-Z]}" = "$IN" ] && continue
        printf "%s %s %s %s\n" "${ENTRIES[$IN",IP"]}" "${ENTRIES[$IN",HOST1"]}" "${ENTRIES[$IN",HOST2"]}" "${ENTRIES[$IN",COMMENT"]}"
  done

This User Gave Thanks to RudiC For This Post:
 

9 More Discussions You Might Find Interesting

1. Cybersecurity

Password Generator

I need a great Password Generator program. I looked at a few of them, but none of them seemed to be what I wanted. So I have decided to write my own. (That's the cool thing about being a programmer....I always get what I want in software :) ) Do you have any password generators that you... (13 Replies)
Discussion started by: Perderabo
13 Replies

2. UNIX for Dummies Questions & Answers

date generator

Is there a command to generate the unix date that is in theshadow file?>? (2 Replies)
Discussion started by: BG_JrAdmin
2 Replies

3. Shell Programming and Scripting

How to compare result lpstat with hostsfile

Hi there all, I got a long list of printers installed and a longer list of printers in my hosts file. In the hosts file I got a even longer list of printers in the hosts file I got the IP adress of all printers next to the printer name. How can I get a script working to get the printers... (0 Replies)
Discussion started by: draco
0 Replies

4. Shell Programming and Scripting

Range generator

Dear All, I have a sorted file like 1 2 3 8 9 10 45 46 47 78 The output will be range like 1 3 8 10 45 47 78 78 (9 Replies)
Discussion started by: saifurshaon
9 Replies

5. Shell Programming and Scripting

Random Sentence Generator

Hi, I need to create a table with random sentences. I need lines that are upto 1000 characters in lenght. I need a random sentence generator that will create sentences and output it to a text file. The sentences should be of lenght varying from 1 to 1000. Does anyone know how this can be... (7 Replies)
Discussion started by: kaushys
7 Replies

6. What is on Your Mind?

Barcode Generator

QR Code Generator (0 Replies)
Discussion started by: Neo
0 Replies

7. Shell Programming and Scripting

time generator

Hi experts, I'd like to generate the table/file containing: number of milliseconds elapsed since midnight till midnight. It should contain 5 columns (hours minutes seconds milliseconds): Table will have theoretically 86 400 000 rows. My question is , is there somewhere the file or source... (7 Replies)
Discussion started by: hernand
7 Replies

8. Shell Programming and Scripting

Sequence generator

Thanks Guys This really helped (5 Replies)
Discussion started by: robert89
5 Replies

9. Shell Programming and Scripting

Generator script

Hello again unix.com people, I need your help again. I'm currently need a script that will generate ip ranges... lets say from 64.1.1.1 to 74.255.255.255 and the output should be like this: 64.1.1.2 64.1.1.3 ............. ............. 74.255.255.254 74.255.255.255 (line-by-line) ... (7 Replies)
Discussion started by: galford
7 Replies
InternetConfig(3)					User Contributed Perl Documentation					 InternetConfig(3)

NAME
Mac::InternetConfig - Interface to Peter Lewis' and Quinns Internet Config system DESCRIPTION
Access to the original Internet Config documentation is essential for proper use of these functions. Constants kICRealName kICEmail kICMailAccount kICMailPassword kICNewsAuthUsername kICNewsAuthPassword kICArchiePreferred kICArchieAll kICUMichPreferred kICUMichAll kICInfoMacPreferred kICInfoMacAll kICPhHost kICWhoisHost kICFingerHost kICFTPHost kICTelnetHost kICSMTPHost kICNNTPHost kICGopherHost kICLDAPServer kICLDAPSearchbase kICWWWHomePage kICWAISGateway kICListFont kICScreenFont kICPrinterFont kICTextCreator kICBinaryTypeCreator kICDownloadFolder kICSignature kICOrganization kICPlan kICQuotingString kICMailHeaders kICNewsHeaders kICMapping kICCharacterSet kICHelper kICServices kICNewMailFlashIcon kICNewMailDialog kICNewMailPlaySound kICNewMailSoundName kICWebBackgroundColour kICNoProxyDomains kICUseSocks kICSocksHost kICUseHTTPProxy kICHTTPProxyHost kICUseFTPProxy kICFTPProxyHost kICFTPProxyUser kICFTPProxyPassword kICFTPProxyAccount Internet Config settings. ICmap_binary ICmap_resource_fork ICmap_data_fork ICmap_post ICmap_not_incoming ICmap_not_outgoing ICservices_tcp ICservices_udp icNoPerm icReadOnlyPerm icReadWritePerm Various constants. Variables $ICInstance The instance of the Internet Config database. %RawInternetConfig Access the raw, uninterpreted value of an Internet Config setting. %InternetConfig Access a sane Perl version of one of the more common Internet Config settings. %InternetConfigMap Access the Internet Config file map to: filename Determine the file type and creator for a newly created file: $map = $InternetConfigMap{"output.html"}; type/creator Determine the extension to use for some type/creator combination: $map = $InternetConfigMap{["WDBN", "MSWD"]}; Types ICMapEntry An entry in the file map. Fields are: short version; OSType file_type; OSType file_creator; OSType post_creator; long flags; Str255 extension; Str255 creator_app_name; Str255 post_app_name; Str255 MIME_type; Str255 entry_name; Functions ICStart ICStart CREATOR Call this at application initialisation. Set creator to your application creator to allow for future expansion of the IC system (Default is MacPerl's creator). Returns a connection to the IC system. ICStop INST It is illegal to call this routine inside a ICBegin/End pair. Call this at application termination, after which INST is no longer valid connection to IC. ICGeneralFindConfigFile INST, SEARCH_PREFS, CAN_CREATE, @FOLDERS ICGeneralFindConfigFile INST, SEARCH_PREFS, CAN_CREATE ICGeneralFindConfigFile INST Mac OS only. It is illegal to call this routine inside a ICBegin/End pair. Call to configure this connection to IC. This routine acts as a more general replacement for ICFindConfigFile and ICFindUserConfigFile. Set search_prefs to 1 (default) if you want it to search the preferences folder. Set can_create to 1 if you want it to be able to create a new config. Set count as the number of valid elements in folders. Set folders to a pointer to the folders to search. Setting count to 0 and folders to nil is OK. Searches the specified folders and then optionally the Preferences folder in a unspecified manner. ICChooseConfig INST Mac OS only. Requires IC 1.2. It is illegal to call this routine inside a ICBegin/End pair. Requests the user to choose a configuration, typically using some sort of modal dialog. If the user cancels the dialog the configuration state will be unaffected. ICChooseNewConfig INST Mac OS only. Requires IC 1.2. It is illegal to call this routine inside a ICBegin/End pair. Requests the user to choose a new configuration, typically using some sort of modal dialog. If the user cancels the dialog the configuration state will be unaffected. ICGetConfigName INST, LONGNAME ICGetConfigName INST Requires IC 1.2. You must specify a configuration before calling this routine. Returns a string that describes the current configuration at a user level. Set longname to 1 if you want a long name, up to 255 characters, or 0 (default) if you want a short name, typically about 32 characters. The returned string is for user display only. If you rely on the exact format of it, you will conflict with any future IC implementation that doesn't use explicit preference files. ICGetConfigReference INST Mac OS only. Requires IC 1.2. You must specify a configuration before calling this routine. Returns a self-contained reference to the instance's current configuration. ICSetConfigReference INST, REF, FLAGS ICSetConfigReference INST, REF Mac OS only. Requires IC 1.2. It is illegal to call this routine inside a ICBegin/End pair. Reconfigures the instance using a configuration reference that was got using ICGetConfigReference reference. Set the icNoUserInteraction_bit in flags if you require that this routine not present a modal dialog. Other flag bits are reserved and should be set to zero. ICGetSeed INST You do not have to specify a configuration before calling this routine. You do not have to be inside an ICBegin/End pair to call this routine. Returns the current seed for the IC prefs database. This seed changes each time a non-volatile preference is changed. You can poll this to determine if any cached preferences change. ICGetComponentInstance INST Mac OS only. Requires IC 1.2. You do not have to specify a configuration before calling this routine. You do not have to be inside an ICBegin/End pair to call this routine. Returns the connection to the IC component. ICBegin INST, PERM You must specify a configuration before calling this routine. It is illegal to call this routine inside a ICBegin/End pair. Starting reading or writing multiple preferences. A call to this must be balanced by a call to ICEnd. Do not call WaitNextEvent between these calls. The perm specifies whether you intend to read or read/write. Only one writer is allowed per instance. Note that this may open resource files that are not closed until you call ICEnd. ICGetPref INST, KEY You must specify a configuration before calling this routine. If you are getting or setting multiple preferences, you should place these calls within an ICBegin/ICEnd pair. If you call this routine outside of such a pair, it implicitly calls ICBegin(inst, icReadOnlyPerm). Reads the preference specified by key from the IC database to the buffer pointed to by buf and size. key must not be the empty string. If called in a scalar context, return the preference. If called in a list context, additionally returns the attributes. Returns icPrefNotFound if there is no preference for the key. ICSetPref INST, KEY, VALUE =item ICSetPref INST, KEY, VALUE, ATTR You must specify a configuration before calling this routine. If you are getting or setting multiple preferences, you should place these calls within an ICBegin/ICEnd pair. If you call this routine outside of such a pair, it implicitly calls ICBegin(inst, icReadWritePerm). Sets the preference specified by KEY from the IC database to the VALUE. If attr is ICattr_no_change (the default) then the preference attributes are not set. Otherwise the preference attributes are set to attr. Returns icPermErr if the previous ICBegin was passed icReadOnlyPerm. Returns icPermErr if current attr is locked, new attr is locked. ICCountPref INST You must specify a configuration before calling this routine. You must be inside an ICBegin/End pair to call this routine. Counts the total number of preferences. ICGetIndPref INST, N You must specify a configuration before calling this routine. You must be inside an ICBegin/End pair to call this routine. Returns the key of the Nth preference. n must be positive. Returns icPrefNotFoundErr if n is greater than the total number of preferences. ICDeletePref INST, KEY You must specify a configuration before calling this routine. You must be inside an ICBegin/End pair to call this routine. Deletes the preference specified by KEY. KEY must not be the empty string. Returns icPrefNotFound if the preference specified by key is not present. ICEnd INST You must specify a configuration before calling this routine. You must be inside an ICBegin/End pair to call this routine. Terminates a preference session, as started by ICBegin. You must have called ICBegin before calling this routine. ICEditPreferences INST, KEY Requires IC 1.1. You must specify a configuration before calling this routine. You do not have to be inside an ICBegin/End pair to call this routine. Instructs IC to display the user interface associated with editing preferences and focusing on the preference specified by key. If key is the empty string then no preference should be focused upon. You must have specified a configuration before calling this routine. You do not need to call ICBegin before calling this routine. In the current implementation this launches the IC application (or brings it to the front) and displays the window containing the preference specified by key. It may have a radically different implementation in future IC systems. ICParseURL INST, HINT, DATA, START, END ICParseURL INST, HINT, DATA Requires IC 1.1. You must specify a configuration before calling this routine. You do not have to be inside an ICBegin/End pair to call this routine. Parses a URL out of the specified text and returns it in a canonical form in a handle. HINT indicates the default scheme for URLs of the form "name@address". If HINT is the empty string then URLs of that form are not allowed. DATA contains the text. START and END should be passed in as the current selection of the text. This selection is given in the same manner as TextEdit, ie if START == END then there is no selection only an insertion point. Also START X END and 0 X START X length(DATA) and 0 X END X length(DATA). If START and END are omitted, the whole of DATA is assumed. In a scalar context, returns URL. In an array context, returns URL, START, END. ICLaunchURL INST, HINT, DATA, START, END ICLaunchURL INST, HINT, DATA Requires IC 1.1. You must specify a configuration before calling this routine. You do not have to be inside an ICBegin/End pair to call this routine. Parses a URL out of the specified text and feeds it off to the appropriate helper. HINT indicates the default scheme for URLs of the form "name@address". If HINT is the empty string then URLs of that form are not allowed. DATA contains the text. START and END should be passed in as the current selection of the text. This selection is given in the same manner as TextEdit, ie if START == END then there is no selection only an insertion point. Also START X END and 0 X START X length(DATA) and 0 X END X length(DATA). If START and END are omitted, the whole of DATA is assumed. In a scalar context, returns URL. In an array context, returns URL, START, END. ICMapFileName INST, NAME Returns the "ICMapEntry" matching best the given name. ICMapTypeCreator INST, TYPE, CREATOR [, NAME] Takes the type and creator (and optionally the name) of an outgoing file and returns the most appropriate "ICMapEntry". ICMapEntriesFileName INST, ENTRIES, NAME Returns the "ICMapEntry" matching best the given name. ICMapEntriesTypeCreator INST, ENTRIES, TYPE, CREATOR [, NAME] Takes the type and creator (and optionally the name) of an outgoing file and returns the most appropriate "ICMapEntry". ICCountMapEntries INST, ENTRIES Counts the number of entries in the map. ICGetIndMapEntry INST, ENTRIES, INDEX Returns the position of a map entry and the entry itself. $map = ICGetIndMapEntry $inst, $entries, 5; ($pos, $map) = ICGetIndMapEntry $inst, $entries, 5; ICGetMapEntry INST, ENTRIES, POS Returns the entry located at position pos in the mappings database. ICSetMapEntry INST, ENTRIES, POS, ENTRY Replace the entry at position pos ICDeleteMapEntry INST, ENTRIES, POS Delete the entry at position pos ICAddMapEntry INST, ENTRIES, ENTRY Add an entry to the database. GetURL URL Launch helper app with URL. Returns undef on error. GetICHelper PROTOCOL Return list of creator ID and name for helper app assigned to PROTOCOL. Returns only creator ID in scalar context. Returns undef on error. AUTHOR
Written by Matthias Ulrich Neeracher <neeracher@mac.com>. Currently maintained by Chris Nandor <pudge@pobox.com>. perl v5.16.2 2013-08-25 InternetConfig(3)
All times are GMT -4. The time now is 06:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy