I currently use the following command to extract the 4th and 9th fields in our Syslog file.
I want to also include all fields in the actual messages starting with the 10th field.
I could do for example; tail messages|awk '{print $4 " " " " $9, $10, $11, $12, $13}'
In the above command, there are many more fields after the 13th field, but rather than inputting all fields, for which I have no idea how many fields there could be. I would rather use an expression (if there is one) that would simply include all fields from field 9 onwards to the end of the message.
Just written a great little script that analyses a flat ASCII CSV file and reports for any discrepancies with field counts per record etc.
Works fine on all the flat files except one, which has 113 fields per line. AWK can only seemingly cope with up to 99 fields.
Is there any way around... (2 Replies)
I'm working on formatting some attendance data to meet a vendors requirements to upload to their system. With some help on the forums here, I have the data close. But they've since changed what they want.
The vendor wants me to submit three fields to them. Field 1 is the studentid field,... (4 Replies)
I have file that I need to remove the duplicates. The problem is, I need to only keep the one which has a unique 3rd field. Here is a sample file:
xxx.xxx:x:CISCO1.CLEVE61W:ERIE.NET:x:x:x:x:
xxx.xxx:x:CISCO2.CLEVE62W:OHIO.NET:x:x:x:x:
xxx.xxx:x:CISCO2.CLEVE62W:NORTH.NET:x:x:x:x:... (1 Reply)
I feel like a real leech now, 3 questions in 3 days, but hopefully when I get my head around all of this I can contribute back to this community!
Anyway, so a couple of you guys have gotten me onto AWK and I've been researching it a little over the last couple of hours, now I'm somewhat sure I... (2 Replies)
Hi,
Could someone please let me know me how i can use an awk command to print the No. of fields of each file present in a Directory?Suppose the Directory has 5 text files in which the first record in each file contains fields separated by a '|'. I need to use a awk command to display the No... (8 Replies)
Hi All,
I am looking for an awk script to do the following
Join the fields together only if the first 4 fields are same.
Can it be done with join function in awk??
a,b,c,d,8,,,
a,b,c,d,,7,,
a,b,c,d,,,9,
a,b,p,e,8,,,
a.b,p,e,,9,,
a,b,p,z,,,,9
a,b,p,z,,8,,
desired output:
... (1 Reply)
Hi experts,
I need to print the first field first then last two fields should come next and then i need to print rest of the fields.
Input :
a1,abc,jsd,fhf,fkk,b1,b2
a2,acb,dfg,ghj,b3,c4
a3,djf,wdjg,fkg,dff,ggk,d4,d5
Expected output:
a1,b1,b2,abc,jsd,fhf,fkk... (6 Replies)
I'm trying to compare 2 files for differences in a selct number of fields. When differnces are found it will write the whole record of the second file including appending '|C' out to a delta file. Each record will have 20 fields, but only want to do comparison of 1st 15 fields. The 1st field of... (7 Replies)
Hi
I have a file as below
<field1> <field2> <field3> ... <field_num1> <field_num2>
Trying to sort based on difference of <field_num1> and <field_num2> in desceding order and print all fields.
I tried this and it doesn't sort on the difference field .. Appreciate your help.
cat... (9 Replies)
Discussion started by: newstart
9 Replies
LEARN ABOUT OSF1
iconv
iconv(1) General Commands Manual iconv(1)NAME
iconv - Converts encoded characters to another codeset
SYNOPSIS
iconv -f from_code -t to_code [file...]
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
iconv: XCU5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
OPTIONS
Specifies the input codeset. Specifies the output codeset.
OPERANDS
Specifies one or more files that contain the data to be converted. If this operand is omitted, the standard input is used.
DESCRIPTION
The iconv command converts the encoding of characters in file from one coded character set to another and writes the results to standard
output.
The input and output coded character sets are identified by from_code and to_code. If the file operand is not specified on the command
line, the iconv command reads the standard input. The result of specifying invalid characters in the input stream is that the input value
is translated to the substitute character.
[Tru64 UNIX] Current industry standards do not specify the name format, implementation, and location of the codeset converters used by
this command. On this operating system, the command searches directories of algorithmic and table converters to find one that performs the
requested conversion. The names of codeset converters adhere to the following format: fromcode_tocode
EXIT STATUS
Success. An error occurred.
ERRORS
[Tru64 UNIX] You can view the diagnostic messages that may be returned by the iconv command by entering the following commands: cd
/usr/lib/nls/msg/en_US.ISO8859-1 dspcat iconv.cat
EXAMPLES
The following examples use the iconv command: To convert the contents of the eucJP_data file from the eucJP to the SJIS codeset and save
the results in the sjis_data file, enter: iconv -f eucJP -t SJIS eucJP_data > sjis_data To convert the contents of the eucJP_data file from
the eucJP codeset to the UCS-4 codeset and save the results in the UCS_4_data file, enter: iconv -f eucJP -t UCS-4 eucJP_data > UCS_4_data
ENVIRONMENT VARIABLES
The following environment variables (see i18n_intro(5) and l10n_intro(5)) affect the execution of the iconv command: Specifies a default
value for the locale category variables that are not set. If set to a nonempty string value, overrides the values of all other locale
variables, including LANG. Determines the locale for interpreting byte sequences as characters in, for example, command parameters. Spec-
ifies the locale used to find translations, if any, for the command's message catalogs. [Tru64 UNIX] Specifies the search path used to
find locales and the subdirectories that contain codeset converters. The default is /usr/lib/nls/loc. Determines the location of message
catalogs for the processing of LC_MESSAGES.
FILES
[Tru64 UNIX] Algorithmic converters. [Tru64 UNIX] Table converters.
SEE ALSO
Commands: genxlt(1)
Functions: iconv(3), iconv_close(3), iconv_open(3)
Others: i18n_intro(5), iconv_intro(5), l10n_intro(5), standards(5)
Writing Software for the International Market
iconv(1)