Sponsored Content
Top Forums Shell Programming and Scripting awk command on .DAT file not working? Post 302767421 by sagar.cumar on Wednesday 6th of February 2013 10:49:21 PM
Old 02-06-2013
Hi Jim,

Apologies and below is expected output. The input file should be splitted based on the column 5 and accordingly it should create output files.

Please find below output scripts.
Code:
DAT_FILENAME_A.DAT
XXXXXXX|YYYYYYY|ZZZZZZZZZZ|12334446456|A|AA|111111111|111111111|111111111||111111111|30|3|NNNNNN|Y||1|AAA|ZZZ|Y|111111111
XXXXXXX|YYYYYYY|ZZZZZZZZZZ|12334446456|A|YY|111111111|111111111|111111111||111111111|15|3|NNNNNN|Y||1|AAA|ZZZ|Y|111111111
DAT_FILENAME_B.DAT
XXXXXXX|YYYYYYY|ZZZZZZZZZZ|12334446456|B|AA|111111111|111111111|111111111|111111111|15|3|NNNNNN|Y|3|AAA|111111111
XXXXXXX|YYYYYYY|ZZZZZZZZZZ|12334446456|B|YY|111111111|111111111|111111111|111111111|15|3|NNNNNN|Y|3|AAA|111111111
DAT_FILENAME_C.DAT
XXXXXXX|YYYYYYY|ZZZZZZZZZZ|12334446456|C|AA|111111111|111111111|111111111|111111111|15|1|NNNNNN|N|4|AAA|BBB|N|111111111
XXXXXXX|YYYYYYY|ZZZZZZZZZZ|12334446456|C|YY|111111111|111111111|111111111|111111111|15|1|NNNNNN|N|4|AAA|BBB|N|111111111
DAT_FILENAME_D.DAT
XXXXXXX|YYYYYYY|ZZZZZZZZZZ|12334446456|D|AA|111111111|111111111|111111111|111111111|45|NNNNNN|Y|IND|111111111
XXXXXXX|YYYYYYY|ZZZZZZZZZZ|12334446456|D|YY|111111111|111111111|111111111|111111111|45|NNNNNN|Y|IND|111111111
DAT_FILENAME_E.DAT
XXXXXXX|YYYYYYY|ZZZZZZZZZZ|12334446456|E|AA|111111111|111111111|111111111||111111111|3|N|N|Y|111111111
XXXXXXX|YYYYYYY|ZZZZZZZZZZ|12334446456|E|YY|111111111|111111111|111111111||111111111|3|N|N|Y|111111111
DAT_FILENAME_F.DAT
XXXXXXX|YYYYYYY|ZZZZZZZZZZ|12334446456|F|AA|111111111|111111111|111111111|111111111|3|N|Y|111111111
XXXXXXX|YYYYYYY|ZZZZZZZZZZ|12334446456|F|YY|111111111|111111111|111111111|111111111|3|N|Y|111111111

Thanks a lot in advance.

Sagar

Last edited by Franklin52; 02-07-2013 at 06:07 AM.. Reason: Please use code tags for data and code samples
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk system() command not working

I am using Sun Solaris 5.8 I am trying to run a system command such as ls and echo inside awk, but when I run the following code system echo is not displayed. bash-2.03$ ls | awk 'BEGIN { print "first print" system("echo system echo") print "second print" ... (1 Reply)
Discussion started by: rakeshou
1 Replies

2. Shell Programming and Scripting

awk command not working

Hi all, Trying to write a script that reads a file and prints everything after a certain string is found to the end of the file. Awk is giving me an error and not sure why it doesn't work: # cat test_file Mon Nov 16 2009 16:11:08 abc def Tue Nov 17 2009 16:08:06 ghi jkl Wed Nov 18... (8 Replies)
Discussion started by: jamie_collins
8 Replies

3. Shell Programming and Scripting

Remove interspersed headers in .dat file with AWK

Heya there, A small selection of my data is shown below. DATE TIME FRAC_DAYS_SINCE_JAN1 2011-06-25 08:03:20.000 175.33564815 2011-06-25 08:03:25.000 175.33570602 2011-06-25 ... (4 Replies)
Discussion started by: gd9629
4 Replies

4. Shell Programming and Scripting

Compute average ignoring outliers of different segments within a dat file using awk

I have data files that look like this, say data.txt 0.00833 6.34 0.00833 6.95 0.00833 7.08 0.00833 8.07 0.00833 8.12 0.00833 8.26 0.00833 8.70 0.00833 9.36 0.01667 20.53 0.01667 6.35 0.01667 6.94 0.01667 7.07 0.01667 8.06 0.01667 8.10 0.01667 8.25 0.01667 8.71 0.01667 9.31... (7 Replies)
Discussion started by: malandisa
7 Replies

5. Shell Programming and Scripting

Awk: System command not working in awk

Hi, I have around 10 files in a folder in which I want to change the file format from tab(\t) to pipe(|) with some changes in the fields as well. Below is the code, while tmp file is getting generated but move command is not working, please help Following is the code awk -F"\t" '{print... (2 Replies)
Discussion started by: siramitsharma
2 Replies

6. Shell Programming and Scripting

awk command not working as expected

Following one line of awk code removes first 3 characters from each line but when I run the same code on another linux platform it doesn't work and only prints blank lines for each record. Can anyone please explain why this doesn't work? (31 Replies)
Discussion started by: later_troy
31 Replies

7. Shell Programming and Scripting

Help with Getting distinct record count from a .dat file using UNIX command

Hi, I have a .dat file with contents like the below: Input file ============SEQ NO-1: COLUMN1========== 9835619 7152815 ============SEQ NO-2: COLUMN2 ========== 7615348 7015548 9373086 ============SEQ NO-3: COLUMN3=========== 9373086 Expected Output: (I just... (1 Reply)
Discussion started by: MS06
1 Replies

8. Shell Programming and Scripting

How to use 'ls' command to list files like *.dat, not *.*.dat?

How to use 'ls' command to list files like *.dat, not *.*.dat (5 Replies)
Discussion started by: pmcginni777
5 Replies

9. Shell Programming and Scripting

Execute a Command in a .Dat File and use it in other Files

We have a process where we store the database password in a config file like below from where the password is picked up and used in Database Scripts ID, Password But we now have a Audit Requirement not to have the passwords in Config Files directly. We have a command which could fetch the... (2 Replies)
Discussion started by: infernalhell
2 Replies

10. Shell Programming and Scripting

Using sed command to replace "|" with ^ for all *.dat files in a folder not working

I am trying to use the below sed command to replace all "|" to ^, in a folder had 50 dat files. when i tried with 1 file it worked but when i tried with wild card, is not working. sed -i 's/"|"/\^/g' *.dat Is this the proper way to use sed command thank you very much for help. (3 Replies)
Discussion started by: cplusplus1
3 Replies
dat_get_handle_type(3DAT)			     Direct Access Transport Library Functions				 dat_get_handle_type(3DAT)

NAME
dat_get_handle_type - get handle type SYNOPSIS
cc [ flag... ] file... -ldat [ library... ] #include <dat/udat.h> DAT_RETURN dat_get_handle_typet ( IN DAT_HANDLE dat_handle, OUT DAT_HANDLE_TYPE *handle_type ) PARAMETERS
dat_handle Handle for a DAT Object. handle_type Type of the handle of dat_handle. DESCRIPTION
The dat_get_handle_type() function allows the Consumer to discover the type of a DAT Object using its handle. The dat_handle can be one of the following handle types: DAT_IA_HANDLE, DAT_EP_HANDLE, DAT_EVD_HANDLE, DAT_CR_HANDLE, DAT_RSP_HANDLE, DAT_PSP_HANDLE, DAT_PZ_HANDLE, DAT_LMR_HANDLE, or DAT_RMR_HANDLE. The handle_type is one of the following handle types: DAT_HANDLE_TYPE_IA, DAT_HANDLE_TYPE_EP, DAT_HANDLE_TYPE_EVD, DAT_HANDLE_TYPE_CR, DAT_HANDLE_TYPE_PSP, DAT_HANDLE_TYPE_RSP, DAT_HANDLE_TYPE_PZ, DAT_HANDLE_TYPE_LMR, DAT_HANDLE_TYPE_RMR, or DAT_HANDLE_TYPE_CNO. RETURN VALUES
DAT_SUCCESS The operation was successful. DAT_INVALID_HANDLE The dat_handle parameter is invalid. USAGE
Consumers can use this operation to determine the type of Object being returned. This is needed for calling an appropriate query or any other operation on the Object handle. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard: uDAPL, 1.1, 1.2 | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
libdat(3LIB), attributes(5) SunOS 5.10 16 Jul 2004 dat_get_handle_type(3DAT)
All times are GMT -4. The time now is 07:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy