I have to generate a tab-delimited flat file. Since few days, I have been getting * in random accounts.
For example, an account supposed to have the value 123456789123,123
Now this is supposed to be in a 12,3 format.
Please note that this being a German field, the comma (,) here means a decimal (.) point.
For past few days, I have been getting 123456789123,12*
This occurs ONLY in one field.
I need a script that will help me remove this asterix from the affected accounts, ONLY in that field. If there are asterix in other fields, I dont want to remove them.
Better yet, do NOT try that, because it will remove *any* asterisks instead of only the ones you want to remove.
First, you have to determine where in line the field is, where you want to remove the asterisk. As an example I will suppose the field is on column 20-30, if you have a delimited format instead of a fixed length format you will have to change accordingly.
To phrase the substitute-expression to only remove asterisks in the columns 5-15 you will have to:
cut out columns 5-15 from the line
run the substitution on it
put the changed part of the line back in
This could be done by sed alone, but would be rather complicated, involving the use of the hold space and in the end the whole script would be pretty counterintuitive (I'll provide the solution upon reqquest if anybody is interested, but it is nothing for the ones with poor nerves ;-) ). An easy way to do it is in a shell script though:
How to convert this:
F1-R1 F1-R2 F1-R3 into a flat file for bash?? Each record
F2-R1 F2-R2 F2-R3
F3-R1 F3-R2 F3-R3
F4-R1 F4-R2 F4-R3is on one line with all fields for that record, put into an output file. The output file should look like this when converted:
F1-R1,F2-R1,F3-R1,F4-R1... (6 Replies)
I need some help to create a script that can do the following:
I have two flat files with one column that should link the two files' information into one record:
1st Flat File - 3 columns, multiple rows:
orderid, Jobnumber, Ordernumber
2nd Flat File - 2 columns, multiple rows:
... (4 Replies)
I have a file like below.
colA^col2^col3^col4^col5
aa^11^aaa^a1a^111^aa*
bb*^22^bbb*^bb2^222^bb
cc^33^ccc*^3cc^333^ccc
dd^44^d*dd*^d4d^444^ddd
ee^55^e*ee^e5e*^555^e*e
NOTE: '^' is the field separator.
I need to get the output as
colA^col2^col3^col4^col5
aa^11^aaa^a1a^111^aa... (5 Replies)
Hi Frnds,
I have a flat file with millions of records. .
Now I on this. (I prefer for AWK as its gives good performance.)
Old_file.txt
------------------
1 gopi ase ....
2 arun pl ...
3 jack sutha ..
4 peter pm ..
...
New_file.txt
---------------
4 peter pm ..
..
... (12 Replies)
i am recieving a flat file ( comma seperated ) with comma in between double quotes in any of the source fields . i need to remove the comma in double quotes and process the file thereafter
fields in file
=========
col1,col2,col3,col4
input can be any of the followng... (31 Replies)
Hi ,
Im relatively new to unix and have to process a comma serparated flat file . I recieve some of the fields in double quotes and i want to remove it ..
INPUT
====
filed1,field2,field3,"fie,ld4"
OUTPUT
=====
field1,field2,field3,"field4"
can anyone tell me how to achieve... (10 Replies)
Hi,
I get some flat files with trailer which gives the totol records count and i want to remove the trailer from the file.
i used the following command it works fine with a single file.
cat file_name | grep -v 'Total records:' > file1
mv file file_name
But i dont know how to remove the... (12 Replies)
Hi Gurus,
I searched the forum but didnt get much info.
I want to compare 2 files.
1)Newfile comes today with
2)Old file of previous day.
The files are same ,just the new files might have new records sometimes.
So I want to capture these new records in another file.
Can anyone help... (5 Replies)
Hello All,
I am brand new to the UNIX world and so far and very intrigued and enjoy scripting. This is just a new language for me. I would really like assistance with the below request. Any help would be greatly appreciated!
I want to create a flat file in Vi that has a header field and... (0 Replies)
I have a flat file like this
0001 THER ULT HEAD & NECK VES
0002 THER ULTRASOUND OF HEART
0003 THER ULT PERIPHERAL VES
0009 OTHER THERAPEUTIC ULTSND
0010 IMPLANT CHEMOTHERA AGENT
0011 INFUS DROTRECOGIN ALFA
0012 ADM INHAL NITRIC OXIDE
I need to conver this to a comma delimited flat file... (2 Replies)