This is another interesting way to do it. Unfortunately, the standards do not specify the behavior of the awk length built-in function when given an array name as an argument. This use is described on the GNU gawk man page and works in BSD awk version 20070501 (but is not documented in the BSD awk man page) that is installed on macOS Mojave (version 10.14.3).
I have no idea whether or not this will work (as an undocumented feature) on green_k's Solaris system in /usr/xpg4/bin/awk or nawk. I also do not know if gawk is installed on green_k's system.
This User Gave Thanks to Don Cragun For This Post:
Hi,
If i have a file with xml format, i would like to remove duplicated records and save to a new file. Is it possible...to write script to do it? (8 Replies)
hi all,
i have a file contain multicolumns, this file is sorted by col2 and col3.
i want to remove the duplicated columns if the col2 and col3 are the same in another line.
example
fileA
AA BB CC DD
CC XX CC DD
BB CC ZZ FF
DD FF HH HH
the output is
AA BB CC DD
BB CC ZZ FF... (6 Replies)
Hi,
I need help with a maybe total simple issue but somehow I am not getting it.
I am not able to etablish a sed or awk command which is adding to the first line in a text and removing only from the last line the ",".
The file is looking like follow:
TABLE1,
TABLE2,
.
.
.
TABLE99,... (4 Replies)
I am trying to load data into 3 tables simultaneously (which is working fine). Then when loaded, it should count the total number of records in all the 3 input files and send an e-mail to the user.
The script is working fine, as far as loading all the 3 input files into the database tables, but... (3 Replies)
Hi Gurus,
I need to cut single record in the file(asdf) to multile records based on the number of bytes..(44 characters). So every record will have 44 characters. All the records should be in the same file..to each of these lines I need to add the folder(<date>) name.
I have a dir. in which... (20 Replies)
HI ,
I am having a huge comma delimiter file, I have to append the following four lines before the starting of the file through a shell script.
FILE NAME = TEST_LOAD
DATETIME = CURRENT DATE TIME
LOAD DATE = CURRENT DATE
RECORD COUNT = TOTAL RECORDS IN FILE
Source data
1,2,3,4,5,6,7... (7 Replies)
Hi,
I need help regarding below concern.
There is a script and it has 7 existing files(in a path say,. usr/appl/temp/file1.txt) and I need to create one new blank file say “file_count.txt” in the same script itself.
Then the new file <file_count.txt> should store all the 7 filenames and... (1 Reply)
I have a file, in which a single record spans across multiple lines,
File 1
====
14|\n
leave request \n
accepted|Yes|
15|\n
leave request not \n
acccepted|No|
I wanted to remove the '\n charecters. I used the below code (foudn somewhere in this forum)
perl -e 'while (<>) { if... (1 Reply)
tinydyndns-data(8) System Manager's Manual tinydyndns-data(8)NAME
tinydyndns-data - add or remove TYPE A record to or from data.cdb
SYNOPSIS
tinydyndns-data add|remove fqdns
DESCRIPTION
fqdns consists of one or more argument, each specifying a fully qualified domain name (fqdn).
tinydyndns-data adds a TYPE A record to or removes it from data.cdb in the current directory. Other than tinydns-data(8), tinydyndns-data
does not know about the source file data but changes the binary database data.cdb directly.
tinydyndns-data reads data.cdb and copies its data to data.tmp. While reading the records, tinydyndns-data checks for each fqdn in fqdns
if this hostname has a TYPE A record in data.cdb, drops the record when called with the option remove, or refuses to add the record when
called with the option add.
When called with the option add, tinydyndns-data then adds all new fqdns to data.tmp. The data of the newly created records can optionally
be controlled through the environment, see below. Finally tinydyndns-data renames data.tmp to data.cdb.
OPTIONS
add For each fqdn in fqdns, add a TYPE A record for fqdn to data.cdb with the default IP address (127.14.14.14).
remove For each fqdn in fqdns, remove all TYPE A records for fqdn from data.cdb.
ENVIRONMENT
IP The environment variable IP overrides the default IP address (``127.14.14.14'') for newly created records. $IP must be a valid IP
address.
TTL time-to-live. The environment variable TTL overrides the default time-to-live in seconds (0 if TTD is set, otherwise 5). $TTL must
be an integer.
TTD time-to-die. $TTD must be an integer, specifying a number of seconds. If TTD is set, the timestamp of newly created records is set
to the current time plus $TTD seconds, and TTL is set to zero by default, so that tinydns(8) interpretes the timestamp as time-to-
die. Note: you probably want to adjust SOA ttl, or create a wildcard record, to prevent DNS caches from caching nxdomain, when
using this feature.
LOC location. $LOC must be two characters long. If LOC is set, it specifies the client location for newly created records.
EXIT CODES
tinydyndns-data exits 111 if anything goes wrong and leaves data.cdb unchanged.
tinydyndns-data exits 0 if all fqdns were processed and the new data.cdb was written.
For each fqdn in fqdns that tinydyndns-data was not able to remove or add (e.g., not there, or already there), it increases the exit code
by one and exits non-zero (maximum is 100).
FILES
./data.cdb
./data.tmp
SEE ALSO tinydyndns-update(8), tinydyndns-conf(8)
http://smarden.org/tinydyndns/
AUTHOR
Gerrit Pape <pape@smarden.org>
tinydyndns-data(8)