Search Results

Search: Posts Made By: pchang
5,154
Posted By pchang
Final Code
This is the final code after some help from vgersh99:



awk -F"," 'FNR==1{next};FNR==NR{a[$1]=$2 FS $3","$4","$5","$6","$7","$8;next} $1 in a {print $0, a[$1]}' OFS='|' a.txt b.txt
5,154
Posted By pchang
Where would I put that additional condition in my...
Where would I put that additional condition in my code?

I tried the following but not getting the desired output.


awk -F"," 'FNR > 1; FNR==NR{a[$1]=$2 FS $3","$4","$5","$6","$7","$8;next} $1...
5,154
Posted By pchang
Compare 2 files using awk but exclude header record from each file
Hi Forum.

I have 2 files (a.txt, b.txt) that I need to match on the first column but need to exclude the header records during comparison from each of the 2 files. This is what I have so far.

...
5,575
Posted By pchang
Thank you to Nezabudka and Rudi C for your...
Thank you to Nezabudka and Rudi C for your inputs.

After doing some additional testing, here's the final code after some tweaking:


awk '
NR==FNR {pat[$1] = $2
next
...
5,575
Posted By pchang
Hi nezabudka. This is an external file that...
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...
5,575
Posted By pchang
Thanks nezabudka for your response. Your code...
Thanks nezabudka for your response. Your code yielded a very close results - only thing is that the update column value is not 12 bytes long (like the original).

Also, if I read your code...
5,575
Posted By pchang
Replace one column from fixed width file with another column from another file
Hi Forum.

I tried to search online for the solution but most of the examples I found the data that I'm trying to manipulate doesn't quite match (col pos#134, 12 bytes) and my code is not working...
1,555
Posted By pchang
Search and replace value based on certain conditions in a fixed width file
Hi Forum.

I tried searching for a solution using the internet search but I haven't been able to find any solution for what I'm trying to accomplish.

I have a fixed width column file where I...
5,319
Posted By pchang
Awesome!!
Thanks to both Stomp and vgersh99 for spending your time and helping me out. This latest awk code works magically great and the results obtained are as expected:


awk '
/<accountHolderName/...
5,319
Posted By pchang
Thank you very much vgersh99. Your code...
Thank you very much vgersh99.

Your code works great for all scenarios.

------ Post updated at 05:19 PM ------

Hi vgersh99.

Sorry to bother you again - My data requirement has changed...
5,319
Posted By pchang
Sorry vgersh99 - the above awk code did not...
Sorry vgersh99 - the above awk code did not return any records - Please have a look.

myXMLfile contains the following good representative data:

<?xml version="1.0" encoding="UTF-8"...
5,319
Posted By pchang
Hi Stomp. I realize that the order of tags...
Hi Stomp.

I realize that the order of tags does not matter but unfortunately we are building the XML file for an external client and they are requesting that the <AdditionalAccountHolders> info...
5,319
Posted By pchang
My XML file will contain many records - some...
My XML file will contain many records - some records will have no holder records and some records may have 1 to 3 holder records.
5,319
Posted By pchang
Hi vgersh99. Thank you for the awk code...
Hi vgersh99.

Thank you for the awk code suggestions. I tried both of your codes with 2 records in my XML file:

1) code#1 doesn't return any records
2) code#2 does return records but it's...
5,319
Posted By pchang
Moving XML tag/contents after specific XML tag within same file
Hi Forum.

I have an XML file with the following requirement to move the <AdditionalAccountHolders> tag and its content right after the <accountHolderName> tag within the same file but I'm not sure...
1,831
Posted By pchang
I'm guessing it's between informatica and...
I'm guessing it's between informatica and Windows.

We are not using cygwin (or running any type of scripts) against the file once it has been generated.
1,831
Posted By pchang
Hi RudiC. We are running our informatica...
Hi RudiC.

We are running our informatica application using Windows Server 2012 R2 OS.

The windows locale is defined as the following:

Current language for non-Unicode programs:

English...
1,831
Posted By pchang
Thanks for all of your replies. We are using...
Thanks for all of your replies.

We are using an ETL tool (informatica) to generate the file. Codepage is currently MS Windows Latin 1 and there are other codepages we can select from.

Not sure...
1,831
Posted By pchang
Hope this helps - Thanks.
0000000 3830 3036 4e4c 4d41 3130 6f54 2a6d 7242
0000020 776f 206e 2020 2020 2020 2020 2020 2020
0000040 2020 2020 2020 2020 2020 2020 2020 3920
0000060 3939 3939 3939 3939 2020 2020 2020 2020...
1,831
Posted By pchang
Shifting of data because of special characters
Hi Forum.

I have a unique problem that I'm hoping someone can assist me.

I'm generating a fixed width file and one of the output column (person_name at col. pos.#483 defined as string(36)...
10,712
Posted By pchang
awk gsub command to replace multiple spaces
Hi Forum.

I'm trying to cleanup the following data elements (To remove any occurences of commas and any extra spaces) while preserving the <TAB> delimiter using awk gsub but I have not been...
3,005
Posted By pchang
Hi Scrutinizer. Thank you for the code...
Hi Scrutinizer.

Thank you for the code suggestion. I tried your code above with the input_file.txt attached but I didn't get any data in the output file.

This is what I executed:


awk -v...
3,005
Posted By pchang
Hi RudiC. If you look at position 33, there...
Hi RudiC.

If you look at position 33, there are 3 different types of segments (UK, UX, CU).

That's why we cannot process the source file as is since each segment can have different data...
3,005
Posted By pchang
Data Sample
Sure can. Thanks.

LF is on the 2nd record (After bolded red text)


00003061895700000000208001X...
3,005
Posted By pchang
awk issue splitting a fixed-width file containing line feed in data
Hi Forum.

I have the following script that splits a large fixed-width file into smaller multiple fixed-width files based on input segment type.

The main command in the script is:

awk -v...
Showing results 1 to 25 of 131

 
All times are GMT -4. The time now is 10:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy