Hi,
I need to add Pipe (|) at 5th and 18th position of all records a file. How can I do this?
I tried to add it at 5th position using the below code. It didnt work. Please help!!!
awk '{substr($0,5,1) ~ /|/}{print}' $input_file > $temp_file (1 Reply)
Hi!
I need to sort file by certain column (column position from-to).
I tried sort command, but it works wrong.
Example:
0001 5214521
0148 6712145
I need to sort this 2 lines by values from position 9 to 12 (bold)
Output:
0148 6712145
0001 5214521
Is there any way how to do this? (2 Replies)
My file is in a good column format but several lines in the file begin with a zero. I'm in KSH and looking for a command to remove this zero and keep the text next to it. I don't want any of the zeros in the other columns removed.
Below is a snip from the file... all I need to do is remove that... (2 Replies)
Greetings.
I have a file with information like this:
AMNDHRKEOEU?AMNDHRKEOEU?AMNDHRKEOEU?AMNDHRKEOEU?
AMNDHRKEEU?AMNDHREOEU?
AMNDHREU?AHRKEOEU?AMNDHRKEU?AMNDKEOEU?
What I need to extract is the position, in every line, of every occurrence of '?'
A desired output would be something... (6 Replies)
Hi All,
I want to remove " character if present in position 25th in CSV file. Each field in CSV file is separated by , and enclosed in "" (enclosed using double quotes)
For example
"1","2","3",........."123 Tom " is Good boy","26",........"45"
Where "1" first position character, ...... 25th... (8 Replies)
Hi,
i want find the character '-' in a file from position 284-298, if it occurs i need to replace it with 'O ' for the position in the file. How to do that using SED command.
thanks in advance,
Sara (9 Replies)
Hi Guys!
Could anyone help me with?..
I have a line which says
BCVGF%6$#900 .....How can we know which position is for % or say $ by command or script?There is any way to get a prompt by any script?
Thanks a lot (6 Replies)
Hi guyz i want to know nth position of character in string. For ex.
var="UK,TK,HK,IND,AUS"
now if we see 1st occurance of , is at 3 position, 2nd at 6,..4th at 13 position.
1st position we can find through INDEX, but what about 2nd,3rd and 4th or may be upto nth position. ?
In oracle we had... (2 Replies)
I will appreciate if you help me here in this script in Solaris Enviroment.
Scenario:
i have 2 files :
1) /tmp/TRANSACTIONS_DAILY_20180730.txt:
201807300000000004
201807300000000005
201807300000000006
201807300000000007
201807300000000008
2)... (10 Replies)
Discussion started by: teokon90
10 Replies
LEARN ABOUT PHP
mb_strrpos
MB_STRRPOS(3) 1 MB_STRRPOS(3)mb_strrpos - Find position of last occurrence of a string in a stringSYNOPSIS
int mb_strrpos (string $haystack, string $needle, [int $offset], [string $encoding = mb_internal_encoding()])
DESCRIPTION
Performs a multibyte safe strrpos(3) operation based on the number of characters. $needle position is counted from the beginning of
$haystack. First character's position is 0. Second character position is 1.
PARAMETERS
o $haystack
- The string being checked, for the last occurrence of $needle
o $needle
- The string to find in $haystack.
o $offset
- May be specified to begin searching an arbitrary number of characters into the string. Negative values will stop searching at an
arbitrary point prior to the end of the string.
o $encoding
-The $encoding parameter is the character encoding. If it is omitted, the internal character encoding value will be used.
RETURN VALUES
Returns the numeric position of the last occurrence of $needle in the $haystack string. If $needle is not found, it returns FALSE.
CHANGELOG
+--------+---------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------+
| 5.2.0 | |
| | |
| | Added the optional parameter $offset. |
| | |
+--------+---------------------------------------+
NOTES
Note
The $encoding parameter was moved from the third position to the fourth in PHP 5.2.0. For backward compatibility, $encoding can be
specified as the third parameter, but doing so is deprecated and will be removed in the future.
SEE ALSO mb_strpos(3), mb_internal_encoding(3), strrpos(3).
PHP Documentation Group MB_STRRPOS(3)