11-06-2009
I have a file FILE1.DAT like below
21111111110001343 000001004OLF-AA029100020091112
21111111110000060 000001004ODL-CH001000020091112
24444444440001416 000001045OLF-AA011800020091112
23333333330001695 000001039OLF-AA030600020091112
23333333330000111 000001039ODL-SP002000020091112
23333333330000060 000001039ODL-CH001000020091112
22222222220000780 000001013OLF-AA006500020091112
i like to append the values only for the position 28:33
OLF-AA to OLF-1E
ODL-SP to ODL-2S
ODL-CH to ODL-3C
21111111110001343 000001004OLF-1E029100020091112
21111111110000060 000001004ODL-3C001000020091112
24444444440001416 000001045OLF-1E011800020091112
23333333330001695 000001039OLF-1E030600020091112
23333333330000111 000001039ODL-2S002000020091112
23333333330000060 000001039ODL-3C001000020091112
22222222220000780 000001013OLF-1E006500020091112
This i want in .KSH script, thanks in advance.
i have the following data in the FILE1
21111111110000204 000029148OLF-AA006300020091112
22222222220004038 000002304OLF-AA012500020091112 0003231 0000060
23333333330003265 000002315OLF-AA039300020091112 0000415
24444444440001344 000009896OLF-AA011200020091112 0000120
25555555550001778 000002331OLF-AA021400020091112
26666666660001098 000002336OLF-AA003400020091112 0000969
27777777770002653 000002349OLF-AA047900020091112
28888888880000636 000026198OLF-AA005300020091112
29999999990000244 000029309OLF-AA004800020091112
21231231230001440 000010268OLF-AA012000020091112 0001200
24564564560004404 000002368OLF-AA020300020091112
i like to append only those line having empty space for the position 50-56 & 58-64 with 7 zeros 0000000 (eg: record line 7, 8 & 9)
the outfile FILE2.txt should be like this
21111111110000204 000029148OLF-AA006300020091112 0000000 0000000
22222222220004038 000002304OLF-AA012500020091112 0003231 0000060
23333333330003265 000002315OLF-AA039300020091112 0000415 0000000
24444444440001344 000009896OLF-AA011200020091112 0000120 0000000
25555555550001778 000002331OLF-AA021400020091112 0000000 0000000
26666666660001098 000002336OLF-AA003400020091112 0000969 0000000
27777777770002653 000002349OLF-AA047900020091112 0000000 0000000
28888888880000636 000026198OLF-AA005300020091112 0000000 0000000
29999999990000244 000029309OLF-AA004800020091112 0000000 0000000
21231231230001440 000010268OLF-AA012000020091112 0001200 0000000
24564564560004404 000002368OLF-AA020300020091112 0000000 0000000
this i like to have in .KSH script
thxs in adv.
Last edited by vbe; 11-06-2009 at 02:00 PM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all;
I'm having headache on append one line to another based on the fix position.Hope u guys can help.
All i need to do is append the line that start with '3' to a line which start with '1' and the position for line 3 that i need to append is 22.
The original file look like this:
... (2 Replies)
Discussion started by: ashikin_8119
2 Replies
2. Shell Programming and Scripting
I need a script for...
how to find a position of column data and print some string in the next line and same position
position should find based on *HEADER8* in text
for ex: ord123 abs 123 987HEADER89 test234
ord124 abc 124 987HEADER88 test235
... (1 Reply)
Discussion started by: naveenkcl
1 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I am a newbie in unix programming so maybe this is a simple question.
I would like to know how can I make a script that outputs only the values that are not between any given start and end positions
Example
file1:
2 30
40 80
82 100
file2:
ID1 1
ID2 35
ID3 80
ID4 81
ID6... (9 Replies)
Discussion started by: fadista
9 Replies
4. Shell Programming and Scripting
Hi i am trying to append value with 0 to an existing file in the position 50-56 & 58-64 only where empty space is there
Rule:
1 row already has some value and i do not want to change anything for this row.
2nd record below you see the position 50-64 is empty, i want to replace with 0000000... (3 Replies)
Discussion started by: kshuser
3 Replies
5. Shell Programming and Scripting
I have a .DAT file like below.
26666666660001343 000001004OLF 029100020090820
27777777770000060 000001004ODL-CH001000020090820
28888888880000780 000001013OLF 006500020090820
.......
........
and so on.....
I want to append each line in a file in .KSH script with XXX with position... (5 Replies)
Discussion started by: kshuser
5 Replies
6. Shell Programming and Scripting
hi,
I have a file which consists of some records:
2010_06_4010093_001_001|10|ABCDEFGH|9|4010093||0040400||31.12.2009|S|O|X||||20100602093851-31.12.2009|XXBBFC|EFG||||00001|
2010_06_4010162_001_001|11|ABCDEFGH|9|4010162||0040400||31.12.2009|S|O|X||||20100602093851-31.12.2009|XXBBFC|EFG||||00002|... (11 Replies)
Discussion started by: pparthiv
11 Replies
7. Shell Programming and Scripting
I want to remove text from nth position to nth position couple of times in same line
my line is
"hello is there anyone can help me with this question"
I need like this
ello is there anyone can help me with question
'h' is removed and 'this' removed from the line. I want to do this... (5 Replies)
Discussion started by: elamurugu
5 Replies
8. Shell Programming and Scripting
hi guys,
i want command or script to display the content of file from 2nd position to last but one position of a file
abcdefghdasdasdsd
123,345,678,345,323
434,656,656,656,656
678,878,878,989,545
4565656667,65656
i want to display the same above file without first and... (2 Replies)
Discussion started by: hemanthsaikumar
2 Replies
9. Shell Programming and Scripting
Hi,
I have a file with multiple lines(fixed width dat file). I want to search for '02' in the positions 45-46 and if available, in that lines, I need to replace value in position 359 with blank. As I am new to unix, I am not able to figure out how to do this. Can you please help me to achieve... (9 Replies)
Discussion started by: Pradhikshan
9 Replies
10. Shell Programming and Scripting
Hi All,
I wanted a sed/awk command to add a value/character on a particular position without disturbing the position of other characters.
I have file a.txt
OL 10031 Day Black Midi Good Value P01 P07
OL 10031 Day Black Short Good Value P01 P07
I want to get the output as... (2 Replies)
Discussion started by: rahulsk
2 Replies
LEARN ABOUT LINUX
dat.conf
DAT.CONF(5) DAT.CONF(5)
NAME
dat.conf - configuration file for static registration of user-level DAT rdma providers
DESCRIPTION
The DAT (direct access transport) architecture supports the use of multiple DAT providers within a single consumer application. Consumers
implicitly select a provider using the Interface Adapter name parameter passed to dat_ia_open().
The subsystem that maps Interface Adapter names to provider implementations is known as the DAT registry. When a consumer calls
dat_ia_open(), the appropriate provider is found and notified of the consumer's request to access the IA. After this point, all DAT API
calls acting on DAT objects are automatically directed to the appropriate provider entry points.
A persistent, administratively configurable database is used to store mappings from IA names to provider information. This provider infor-
mation includes: the file system path to the provider library object, version information, and thread safety information. The location and
format of the registry is platform dependent. This database is known as the Static Registry (SR) and is provided via entries in the
dat.conf file. The process of adding a provider entry is termed Static Registration.
Registry File Format
* All characters after # on a line are ignored (comments).
* Lines on which there are no characters other than whitespace
and comments are considered blank lines and are ignored.
* Non-blank lines must have seven whitespace separated fields.
These fields may contain whitespace if the field is quoted
with double quotes. Within fields quoated with double quotes,
the backslash or qoute are valid escape sequences:
* Each non-blank line will contain the following fields:
- The IA Name.
- The API version of the library:
[k|u]major.minor where "major" and "minor" are both integers
in decimal format. User-level examples: "u1.2", and "u2.0".
- Whether the library is thread-safe: [threadsafe|nonthreadsafe]
- Whether this is the default section: [default|nondefault]
- The library image, version included, to be loaded.
- The vendor id and version of DAPL provider: id.major.minor
- ia params, IA specific parameters - device name and port
- platform params, (not used)
Example netdev entries for OpenFabrics rdma_cm providers, both v1.2 and v2.0
OpenIB-cma u1.2 nonthreadsafe default libdaplcma.so.1 dapl.1.2 "ib0 0" ""
ofa-v2-ib0 u2.0 nonthreadsafe default libdaplofa.so.2 dapl.2.0 "ib0 0" ""
NOTE: The OpenFabrics providers use <ia_params> to specify the device with one of the following:
network address, network hostname, or netdev name; along with port number.
The OpenIB- and ofa-v2- IA names are unique mappings. Reserved for OpenFabrics providers.
The default location for this configuration file is /etc/dat.conf. The file location may be overridden with the environment variable
DAT_OVERRIDE=/your_own_directory/your_dat.conf.
SEE ALSO
25 March 2008 DAT.CONF(5)