View previous topic :: View next topic
|
Author |
Message |
Megha Kaushik
New User
Joined: 04 Oct 2022 Posts: 1 Location: United Kingdom
|
|
|
|
Hi All,
Can you please help me out with one query.
I have a file with 4 columns delimited by '|' with rows having duplicates at position 55 to 59 (the last column)
So I want to checks the rows for matching field at the last columns (12345=12345) and delete the row with blanks in the First 3 columns
Example:
aaa|bbb|ccc|12345
|||12345
xxx|yyy|zzz|55544
When I try sorting the file from columns 55 to 59 it gives me error that Sorting starts from 1 position. How can I check for the above mentioned scenario. Please advise. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1337 Location: Bamberg, Germany
|
|
|
|
Use code tag button when presenting code/data here. What have you tried yourself? Post error messages and such things you might have got. Thanks! |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
Megha Kaushik wrote: |
Hi All,
Can you please help me out with one query.
I have a file with 4 columns delimited by '|' with rows having duplicates at position 55 to 59 (the last column)
So I want to checks the rows for matching field at the last columns (12345=12345) and delete the row with blanks in the First 3 columns
Example:
aaa|bbb|ccc|12345
|||12345
xxx|yyy|zzz|55544
When I try sorting the file from columns 55 to 59 it gives me error that Sorting starts from 1 position. How can I check for the above mentioned scenario. Please advise. |
First of all, learn how to use the Code button:
Code: |
aaa|bbb|ccc|12345
|||12345
xxx|yyy|zzz|55544 |
Next, copy here everything of:
1) your input data (using Code button!) including the description of dataset attributes
2) your own used code (using Code button!)
3) your desired output data (using Code button!)
4) your actual output data (using Code button!)
5) all and every error message, and/or error code you get (using Code button!)
Otherwise you may continue posting your messages forever, if you prefer doing so. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1337 Location: Bamberg, Germany
|
|
|
|
Code: |
OPTION COPY
OMIT COND=(1,79,SS,RE,C'^[ ]*\|[ ]*\|[ ]*\|12345')
END |
will eliminate the line with blanks or empty content in the first three columns when fourth column is equal to "12345"
As others have mentioned, please take note of their advice and provide more data to make it easier for us to help you in the future. |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1337 Location: Bamberg, Germany
|
|
|
|
Update: Use CP 1047 for the Regular Expression, otherwise it will not properly work. |
|
Back to top |
|
|
|