09-13-2004
Filed substitution with awk
guys,
I'm trying to 9k lines of the following:
aaa aaa 1 1 1
to
aaa aaa 1 01 1
Im pretty ignorant when it comes to subtituting fields using awk
any help ?
Tony
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I need to copy field 2 to field 3 for only those records that have the 1st field equal to account
e.g. file
account|123|789|xxx|yyy|zzz|...
account_group|444|555|xxx|yy|zz|....
account|456|901|aaa|bbb|ccc|.....
after running awk script should look like
account|123|123|xxx|yyy|zzz|...... (4 Replies)
Discussion started by: klut
4 Replies
2. Shell Programming and Scripting
Hi again.
A have a CSV-file in the following format:
2008.09.01,15:17:42,9227096485,9233175320,CTC10,SMS,0901151742098314,Target_MSIS
DN_is_blacklisted
I want to have an awk command that will say:
If the first 3 digits of $4 does not begin with 922 or 923, then make $8 say "Invalid... (3 Replies)
Discussion started by: daytripper1021
3 Replies
3. Shell Programming and Scripting
I am trying to use AWK to replace dallinux02 to dallinux03 everywhere in the servers.txt file and move it over to "awk2".
Here is my script "awk2.awk":
gsub(/dallinux02/, "dallinux03"); print > "awk2"
I am trying to run this using the following:
$ awk -f awk2.awk... (3 Replies)
Discussion started by: ora_umair
3 Replies
4. Shell Programming and Scripting
I try to trim a FTP log using awk, but the escape sequences does not work the way I want it.
Input data Wed 3Oct10 21:48:00 - (002117) Sent file d:\ftp\home\tools\htmake.rar successfully (48.2 kB/sec - 40997 Bytes)
Wed 3Oct10 22:25:46 - (002118) Sent file d:\ftp\files\main\oct\camera1... (4 Replies)
Discussion started by: Jotne
4 Replies
5. Shell Programming and Scripting
Experts,
Good day!,
I have following data, I want to filter 3rd Field, if it is in UPPERCASE,
aa aa1 HOST1
aa bb1 host2
aa cc1 SERV1
aa dd1 SERV2
ab aa1 host3
The output should be:
aa aa1 HOST1
aa cc1 SERV1
aa dd1 SERV2 (2 Replies)
Discussion started by: rveri
2 Replies
6. Shell Programming and Scripting
Hi all,
I need some help with substitution in awk.
Is it possible to substitute field from awk output with string from file?
For example:
zcat /SMS/CDR/cdr_TC/callLogs*_*_2013092710*.gz | sed 's/:/;/g' | awk -F";" '{if($2==1 && $10~/389123456789/) print $36";"$37}'
2;19733248
I want... (6 Replies)
Discussion started by: vasil
6 Replies
7. Shell Programming and Scripting
Hi,
I have a tab delimited file as below:
AWA Divi DD01 None 1 2 Room AC 01-MAY-15 31-OCT-15 OT 01-MAY-15 31-OCT-15 CF 01-MAY-15 31-OCT-15
AW0 Beach DD02 None 1 2 Double AC 01-MAY-15 31-OCT-15 AD 01-MAY-15 31-OCT-15
The number of columns(fields) after 7th field is not fixed and... (3 Replies)
Discussion started by: Bobby_2000
3 Replies
8. Shell Programming and Scripting
There is an usual ifconfig output
vlan30 Link encap:Ethernet HWaddr
inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: 2407:4c00:0:1:aaff::1/64 Scope:Global
inet6 addr: fe80::224:e8ff:fe6b:cc4f/64 Scope:Link
UP BROADCAST... (1 Reply)
Discussion started by: urello
1 Replies
9. UNIX for Beginners Questions & Answers
Dear Team,
I need support to use awk program to grep data based on matching pattern first 5 digits "96656" .
Data I have as below
466565996656,820012906026651 NA NOTMATCHED
4661740045165,820011902196656 NA NOTMATCHED
4661740085225,820011900196656 NA NOTMATCHED... (4 Replies)
Discussion started by: shanul karim
4 Replies
LEARN ABOUT OSX
dnssec-dsfromkey
DNSSEC-DSFROMKEY(8) BIND9 DNSSEC-DSFROMKEY(8)
NAME
dnssec-dsfromkey - DNSSEC DS RR generation tool
SYNOPSIS
dnssec-dsfromkey [-v level] [-1] [-2] [-a alg] {keyfile}
dnssec-dsfromkey {-s} [-v level] [-1] [-2] [-a alg] [-c class] [-d dir] {dnsname}
DESCRIPTION
dnssec-dsfromkey outputs the Delegation Signer (DS) resource record (RR), as defined in RFC 3658 and RFC 4509, for the given key(s).
OPTIONS
-1
Use SHA-1 as the digest algorithm (the default is to use both SHA-1 and SHA-256).
-2
Use SHA-256 as the digest algorithm.
-a algorithm
Select the digest algorithm. The value of algorithm must be one of SHA-1 (SHA1) or SHA-256 (SHA256). These values are case insensitive.
-v level
Sets the debugging level.
-s
Keyset mode: in place of the keyfile name, the argument is the DNS domain name of a keyset file. Following options make sense only in
this mode.
-c class
Specifies the DNS class (default is IN), useful only in the keyset mode.
-d directory
Look for keyset files in directory as the directory, ignored when not in the keyset mode.
EXAMPLE
To build the SHA-256 DS RR from the Kexample.com.+003+26160 keyfile name, the following command would be issued:
dnssec-dsfromkey -2 Kexample.com.+003+26160
The command would print something like:
example.com. IN DS 26160 5 2 3A1EADA7A74B8D0BA86726B0C227AA85AB8BBD2B2004F41A868A54F0 C5EA0B94
FILES
The keyfile can be designed by the key identification Knnnn.+aaa+iiiii or the full file name Knnnn.+aaa+iiiii.key as generated by
dnssec-keygen(8).
The keyset file name is built from the directory, the string keyset- and the dnsname.
CAVEAT
A keyfile error can give a "file not found" even if the file exists.
SEE ALSO
dnssec-keygen(8), dnssec-signzone(8), BIND 9 Administrator Reference Manual, RFC 3658, RFC 4509.
AUTHOR
Internet Systems Consortium
COPYRIGHT
Copyright (C) 2008 Internet Systems Consortium, Inc. ("ISC")
BIND9 November 29, 2008 DNSSEC-DSFROMKEY(8)