Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Replace one column from fixed width file with another column from another file Post 303044954 by pchang on Monday 9th of March 2020 05:18:28 PM
Old 03-09-2020
Hi nezabudka.

This is an external file that we receive from a third party vendor and there's no guarantee that we will always have a space in between the fields (so NF-4 might not always work correctly).

I think it would be better to look for field value starting at column position#134 for 12 bytes and replace that value. Then we wouldn't need to be concerned if it's "DR" or "CR" or something else.

Unfortunately, I'm stuck on how to go about writing the code.

Let me know if you need any other clarifications.

Thanks
Paul
This User Gave Thanks to pchang For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Comparing column of variable length anf fixed width file

Hi, I have two input files. File1: ID Name Place 1-234~name1~Newyork 1-34~name2~Boston 1-2345~name3~Hungary File1 is a variable length file where each column is seperated by delimitter "~". File2: ID Country 1-34<<11 SPACES>>USA<<7 spaces>> 1-234<<10 SPACES>>UK<<8... (5 Replies)
Discussion started by: manneni prakash
5 Replies

2. Shell Programming and Scripting

edit entire column from a fixed-width file using awk or sed

Col1 Col2 Col3 Col4 12 Completed 08 0830 12 In Progress 09 0829 11 For F U 07 0828 Considering the file above, how could i replace the third column the most efficient way? The actual file size is almost 1G. I am... (10 Replies)
Discussion started by: tamahomekarasu
10 Replies

3. Shell Programming and Scripting

Changing one column of delimited file column to fixed width column

Hi, Iam new to unix. I have one input file . Input file : ID1~Name1~Place1 ID2~Name2~Place2 ID3~Name3~Place3 I need output such that only first column should change to fixed width column of 15 characters of length. Output File: ID1<<12 spaces>>Name1~Place1 ID2<<12... (5 Replies)
Discussion started by: manneni prakash
5 Replies

4. Shell Programming and Scripting

row to column and position data in to fixed column width

Dear friends, Below is my program and current output. I wish to have 3 or 4 column output in order to accomodate in single page. i do have subsequent command to process after user enter the number. Program COUNT=1 for MYDIR in `ls /` do VOBS=${MYDIR} echo "${COUNT}. ${MYDIR}" ... (4 Replies)
Discussion started by: baluchen
4 Replies

5. UNIX for Dummies Questions & Answers

Remove duplicates based on a column in fixed width file

Hi, How to output the duplicate record to another file. We say the record is duplicate based on a column whose position is from 2 and its length is 11 characters. The file is a fixed width file. ex of Record: DTYU12333567opert tjhi kkklTRG9012 The data in bold is the key on which... (1 Reply)
Discussion started by: Qwerty123
1 Replies

6. Shell Programming and Scripting

How to split a fixed width text file into several ones based on a column value?

Hi, I have a fixed width text file without any header row. One of the columns contains a date in YYYYMMDD format. If the original file contains 3 dates, I want my shell script to split the file into 3 small files with data for each date. I am a newbie and need help doing this. (14 Replies)
Discussion started by: bhanja_trinanja
14 Replies

7. Shell Programming and Scripting

To replace the value of the column in a fixed width file

I have a fixed with file with header & trailer length having the same length of the detail record file. The details record length of this file is 24, for Header and Trailer the records will be padded with spaces to match the record length of the file Currently I am adding 3 spaces in header... (14 Replies)
Discussion started by: ginrkf
14 Replies

8. Shell Programming and Scripting

Print column details from fixed width file using awk command

hi, i have a fixed width file with multiple columns and need to print data using awk command. i use: awk -F "|" '($5 == BH) {print $1,$2,$3}' <non_AIM target>.txt for a delimiter file. but now i have a fixed width file like below: 7518 8269511BH 20141224951050N8262 11148 8269511BH... (5 Replies)
Discussion started by: kcdg859
5 Replies

9. Shell Programming and Scripting

UNIX command -Filter rows in fixed width file based on column values

Hi All, I am trying to select the rows in a fixed width file based on values in the columns. I want to select only the rows if column position 3-4 has the value AB I am using cut command to get the column values. Is it possible to check if cut -c3-4 = AB is true then select only that... (2 Replies)
Discussion started by: ashok.k
2 Replies
naaagt(1M)																naaagt(1M)

NAME
naaagt - Native Agent Adapter (NAA) SYNOPSIS
priority] logMask] ... DESCRIPTION
The Native Agent Adapter allows third-party SNMP agents to work with the HP SNMP Master Agent The Native Agent Adapter runs as a subagent to the HP SNMP Master Agent. reads the file (see the environment variable, described below), and it registers each object identifier (OID) with See the section. After registration is complete, receives SNMP requests from and forwards them to a non-standard UDP port on the same system (see the envi- ronment variable, described below). also receives SNMP responses from the third-party SNMP agent, which is listening to the non-standard UDP port, and forwards the responses to The third-party SNMP agent must listen to the same non-standard UDP port that sends to not the standard SNMP port number(161). Refer to third-party documentation for instructions on how to accomplish this. The third-party SNMP agent can be started before or after starting Parameters Sets the registration priority. If two subagents register the same OIDs, requests are sent to the subagent with the highest priority or to the subagent with the same priority that was the last to register. The priority range is zero (high) to 255 (low). Default: zero. Causes the Native Agent Adapter to continue to run, even if the HP SNMP Master Agent terminates. When subsequently restarts, will re-establish communica- tion with and re-register its OIDs. This option is recommended if the procedure is used, described below. By default, ter- minates automatically when terminates. Troubleshooting Parameters Displays usage information. Sets the logging mask. may be one of the following names: or Multiple logging options can be specified by repeating the option. Logging data is written to the SNMP log file, Default: Causes to run in foreground. By default, runs in the background. Native Agent Adapter Start-up The Native Agent Adapter start-up procedure may be provided by the vendor of the third-party SNMP agent. Refer to third-party documenta- tion for instructions. The third-party SNMP agent and its Native Agent Adapter can be started and stopped automatically during system start-up and shutdown. This is accomplished by providing a start-up/shutdown script under the directory, with symbolic links to it under an appropriate directory. See the rc(1M) man page for details. See the section for procedures for starting The third-party SNMP agent and its Native Agent Adapter can be started using the command by providing start-up and shutdown scripts under Normally, those scripts are merely symbolic links to the automatic start-up/shutdown script under following the same naming conventions documented in the rc(1M) manual page. These scripts are executed by the command. See the section for procedures for starting The third-party SNMP agent and its Native Agent Adapter can be started by entering commands directly or by executing an arbitrary script. When this approach is used, the option should probably be used because the third-party agent and adapter will not be restarted by the com- mand. The following procedure should be used to start for each third-party agent. o Export which must be set to a unique port number. o Export which must be set to an absolute path name for a third-party-specific file. Create the file; refer to third-party docu- mentation for a list of the OIDs that are instrumented by the third-party SNMP agent. o Export which must be set to the community name to be used in SNMP requests forwarded from to the third-party SNMP agent. This environment variable is required only if the third-party agent is configured to use a community name other than the default ("public"). o Create a unique symbolic link to This makes it convenient to distinguish each Native Agent Adapter in output from the command. Execute the symbolic link to start o Start the third-party SNMP agent, following procedures in the third-party documentation. This can be done before or after start- ing naaCnf File Format The file consists of a list of numeric object identifiers (OIDs), one OID per line. Each OID is a subtree of MIB variables that are instrumented by the third-party SNMP agent. Refer to third-party documentation for the list of OIDs. Blank lines and lines beginning with "#" are treated as comments. Leading and trailing spaces on a line are ignored. The OID can start with an optional period. EXTERNAL INFLUENCES
Environment Variables The absolute path name for the file from which the Native Agent Adapter reads the OIDs to be registered for its third-party SNMP agent. Default (not recommended): The community name that the Native Agent Adapter uses in SNMP requests forwarded to the third-party SNMP agent. Note that this does not have to match any community names accepted by the SNMP Master Agent, which are defined in This environment variable is required only if the standard community name ("public") is not accepted by the third-party SNMP agent. Refer to third-party documenta- tion for instructions regarding SNMP community names. Default: public. The non-standard UDP port number to which the Native Agent Adapter forwards SNMP requests to the third-party SNMP agent. This must match the port number that the third-party agent listens to instead of the standard SNMP port(161). Each third-party SNMP agent must listen to a different non- standard UDP port number. Default: 8161. International Code Set Support Supports single-byte character code sets except where the SNMP protocol supports only 7-bit characters encoded in ASCII. WARNINGS
The Native Agent Adapter only supports SNMP read requests (for example, SNMP Get). SNMP Set requests must be sent directly to the third- party SNMP agent's non-standard UDP port If the value is not a valid port number, terminates without writing any error message either to the display or to If there are no valid OIDs in the file, terminates. It does not register a default OID. There may be unexpected results if the is outside the valid range. AUTHOR
was developed by SNMP Research and Hewlett-Packard Company. FILES
Default file. Not recommended. Directory for SNMP start-up and shutdown scripts. Native Agent Adapter command. HP SNMP Master Agent command. HP SNMP log file. SEE ALSO
rc(1M), snmpd(1M), snmpd.conf(4). naaagt(1M)
All times are GMT -4. The time now is 10:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy