Search Results

Search: Posts Made By: agathaeleanor
3,376
Posted By agathaeleanor
It is not working as if the output swapped...
It is not working as if the output swapped between the first chunk of the carriage return with second chunk of the carriage return.

input sample:
a|b|c|d
e|e|f|g|h

Output:
e|e|f|g|h
a|b|c|d...
3,376
Posted By agathaeleanor
Thanks zaxxon for your reply, sad to say that it...
Thanks zaxxon for your reply, sad to say that it is not working...
3,376
Posted By agathaeleanor
the actual input file, ...
the actual input file,

VALUE_ID|HPB_DIV_DEPT|KPI_ID|KPI_DESC|YEAR|VERSION|KPI_VALUE|KPI_VALUE_NUM|KPI_PERFORM|VALUE_STATUS|INACTIVE_DATE|UPDATED_DATE|UPDATED_BY|REMARKS|CREATED_DATE|MODIFIED_DATE...
3,376
Posted By agathaeleanor
Yea, zaxxon. I have tested with your code also. ...
Yea, zaxxon. I have tested with your code also.
It works with sample file, but not with my actual file.

Modified to be

/usr/xpg4/bin/awk -F\| 'NF<16 {l=l? l OFS $0: l $0; next} l {print l} 1...
3,376
Posted By agathaeleanor
Yes, rdcwayx, i have been posting the...
Yes, rdcwayx, i have been posting the carriage-return-related topic as i yet resolve the issue :(

awk '{printf /^col1/||/^[0-9]/?RS $0:":::" $0}' infile

I executed the above code, running fine...
3,376
Posted By agathaeleanor
2 carriage return within a record
Hi all,

need your help in replacing carriage return in a record.

Input:

col1|col2|col3|col4|col5|col6|col7|col8|col9|col10
1|aa|bb|cc|dd|eee
eee|ff|ggggg|hh
hhh|iii...
1,563
Posted By agathaeleanor
Thanks a lot rdcwayx. It works. I have one...
Thanks a lot rdcwayx. It works.

I have one last question, when i print the output to file.txt the first line in file.txt is empty row. How to avoid that?
1,563
Posted By agathaeleanor
Sorry for missing out something in the Output.txt...
Sorry for missing out something in the Output.txt
I have compensated it as attached.

The code works fine, just that in column 23, if there is a carriage return, I need to replace it with 3 colon...
1,563
Posted By agathaeleanor
Thanks rdcwayx for your code. When i tried...
Thanks rdcwayx for your code.

When i tried the code, it hits error.

nawk: syntax error at source line 1
context is
{print >>> /^[0-9]+\|/||NR== <<<
nawk: illegal statement at...
1,563
Posted By agathaeleanor
i attached the input(Input.txt) and desired...
i attached the input(Input.txt) and desired output (Output.txt) file as requested.

Requirement:
1. all carriage return existed in all columns except column 23 will replace with a space (the...
1,563
Posted By agathaeleanor
need help in awk command
Hi all gurus,

Need your help in modifying the script written by tukuyomi and shipra_31
grep -v '^$' file.txt | nawk -F\| 'FNR==1{n=NF}NF<n{l=$0;getline;$0=l" "$0}1' > file_1.txt

This script is...
10,237
Posted By agathaeleanor
Thanks all for your response. Mirni, sorry...
Thanks all for your response.

Mirni, sorry for the confusion. I uploaded the actual input file for your reference.

Correct_input.txt is the desired output.

However, sometimes the data may...
10,237
Posted By agathaeleanor
Thanks mirni for your reply, the script able to...
Thanks mirni for your reply, the script able to run now.

However, it doesnt work for my actual source file. The sample input file is merely example, i apologize for this.

Actual input file...
3,990
Posted By agathaeleanor
Thanks for your explanation. I tested the...
Thanks for your explanation.

I tested the script, and it doesnt work for awk command. Thus, i changed to nawk command.

It hits below error:

nawk: you can only delete array[element] at source...
10,237
Posted By agathaeleanor
Thanks all for your help. I tried to run...
Thanks all for your help.

I tried to run mirni's script, but it seems that i cant get through.
I suspected 'awk' command is not working, thus i changed to 'nawk'.

But i come to this error upon...
10,237
Posted By agathaeleanor
Thanks anchal_khare for your prompt reply. ...
Thanks anchal_khare for your prompt reply.

In the example input, col3 is called multivalue column.
According to the requirement, user has not specified the fix number of value it might contain...
3,990
Posted By agathaeleanor
Thanks Chubler_XL for the code. I haven't...
Thanks Chubler_XL for the code.

I haven't test out the script given. I am trying to understand the script before testing on the source file. I have included the comment on each if else statement,...
10,237
Posted By agathaeleanor
Replace pipe <|> with comma <,> in a column
Hi All Gurus,

I need to replace a pipe <|> with a comma <,> in a few columns with pipe delimited file. The column name are fixed for the replacement of comma <,>.
For below example, Col3, Col6...
3,990
Posted By agathaeleanor
it doesn't work here. It shows only the column...
it doesn't work here.
It shows only the column header, the rest of data is chopped off.

output:
col1|col2|col3|col4|col5|col6|col7|Remarks|col9|col10
3,990
Posted By agathaeleanor
Thanks Shipra_31 for the script. However,...
Thanks Shipra_31 for the script.

However, when in below situation - carriage return is occurred after "16", it is not working. In addition, it should not add <:::> How to tackle this? your help is...
3,990
Posted By agathaeleanor
refine awk command in replacing carriage return
Hi,

need your help in below,I have 4 types of file need to be processed so that it will replace carriage return in Remarks column with <:::>
Remarks column position may varies in different types...
2,178
Posted By agathaeleanor
thanks a lot tukuyomi, it works.
thanks a lot tukuyomi, it works.
2,178
Posted By agathaeleanor
yes, it is always in the first line of the source...
yes, it is always in the first line of the source text file.
2,178
Posted By agathaeleanor
Replace carriage return with colon on specific column
Hi,

I have to process four source text files with possibility to contain carriage return on the particular column. Thus, i need to replace the carriage return with 3 colons <:::>

The particular...
4,728
Posted By agathaeleanor
Yazu, thanks. In that case, how do i count...
Yazu, thanks.

In that case, how do i count the max number of column in the source file? Indeed, the source file comes with column header.
Showing results 1 to 25 of 37

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