The output you provided for your sample input doesn't even come close to your stated requirements.
You said you want to sort on fields 2, 3, 4, and 1 which with your sample input would be:
Then you say you want to insert a carriage return after every sorted field which would insert four <carriage-return> characters into each line of your output (shown below using <CR> as a representation of the <carriage-return> characters instead of using actual <carriage-return> characters which would cause overprinting of characters in your output lines:
If what you meant was that you wanted to insert an empty LINE after every change in the field 4 value in the sorted output and add the string txt. followed by the field 4 value on the preceding lines in that group, that output would be:
But, of course, your sample output has SearchService-WW sorting before AdminConsole-ww and puts the inserted lines before changes in field 4 values instead of after.
Please explain these discrepancies and provide new sample output (in CODE tags), new requirements, or both so that the output you show us matches the requirements you have provided.
Hello,
Can someone please share a Simple AWK command to append Carriage Return & Line Feed to the end of the file, If the Carriage Return & Line Feed does not exist !
Thanks (16 Replies)
I need to remove the carriage return comes inbetween the record.
Need to have CR only at the end.
I used the below command.
tr -d '\n' < filewithcarriagereturns > filewithoutcarriagereturns
But its removing all the CR and giving one line output.
Input File:
12345
abcdegh... (11 Replies)
Hello all,
I've a flat file in the following format:
AB\001\CDED\001\ABC\001\nEG\001\HIJF\001\EFG\001\nHI\003\HIUL\003\HIJ\003
And I want to substitute \n with the carriage return. Any help is appreciated!
Regards,
- Seth (8 Replies)
Hi,
I have a pipe delimited file. There are around 700 columns in the file.
The 65th column has carriage return which is causing read issue with our ETL process. I would like to replace the new line characters in 65th field with "nothing"
i have return the following code and need help to... (7 Replies)
Hello,
How do i usecarriage return in ksh.
I want to do an echo "bla bla" and another echo "bla bla" will appear and replace the first echo on screen.
I tried:
until ; do
echo "bla bla \r"
done
please advice.
Thanks. (3 Replies)
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
2|zz|yy|xx|ww|vv|uu|tt|ss|rr
Output:
col1|col2|col3|col4|col5|col6|col7|col8|col9|col10... (12 Replies)
Hi I would like to add carriage return at end of file,
because we need to mask the customer names for detailed records.
Some what the file doesnot have carriage at end of line of last record.So that i 'll get 2 records when use
---aa.txt-----
1|aaa|bbb|ccc
2|bbbb|hghgh|ggg
000002
tail... (2 Replies)
I have observed with print & echo, they produce carriage return <CR> or newline, after they display string next to them.
Is there anyway to avoide these <CR> after the intended string is displayed? (3 Replies)
I try to test the carriage return in a variable.
$ LENGTH=`expr $VARIABLE : ".*"` will return the length of the variable. But this doesn't work if $VARIABLE has zero length.
Any help will be well appreciated.
Thanks in advance.
Giovanni (4 Replies)