You could also try something like:
which should work with any sed and any delimiter character. (However, some versions of sed will fail with this if your delimiter is a multibyte character.)
With the input file file containing:
it produces the output:
Hi,
I have the following data in a flat file:
abcd_efgh_ijkl_20080522.dat|20080602222508|1357
abcd_efgh_ijkl_20080522.dat|20080602222508|1357
abcd_efgh_ijkl_20080522.dat|20080602222508|1357
I need to check the no. of occurence of "|" (pipe) on each line and the output should look like below:... (4 Replies)
How to use sed to remove html tags including text between them?
Example: User <b> rolvak </b> is stupid. It does not using <b>OOP</b>!
and should output: User is stupid. It does not using !
Thank you.. (2 Replies)
seems easy but havent found in other posts...
i want to delete any spaces if found before first occurence of ${AI_RUN}
sed 's/ *\\$\\{AI_RUN\\}/\\$\\{AI_RUN\\}/' $HOME/temp1.dat
i think i'm close but can't put my finger on it. :rolleyes: (6 Replies)
Hello Experts,
I have a file "tt.txt" which is like:
#a1=a2
b1=b2
#c1=c2
I need to remove the pound (#) sign from a particular line. In this case let us assume it's 3rd line : "#c1=c2"
I can do it through:
sed "s/#c1=c2/c1=c2/" tt.txtbut it is possible that I may not know the value... (6 Replies)
I have the following line:
4/23/2010 0:00:38.000: Copying $$3MSYDDC02$I would like to use sed (or similiar) to remove everthing between and including $ that appears in the line so it ends up like this.
4/23/2010 0:00:38.000: Copying 3MSYDDC02I have been trying these but i'm really just... (5 Replies)
Hi
I have a file which has aroun 200 line and it is like this:
GROUP2-WDI">GROUP2-WDI
GROUP3-WDI">GROUP3-WDI
KL2P0508BC">KL2P0508BC
KL2P0508BIT">KL2P0508BIT
KL3P0506BC">KL3P0506BC
KL3P0506BUS">KL3P0506BUS
KLD1F0507DBT">KLD1F0507DBT
KLD1F0507DIT">KLD1F0507DIT
KLD1F0510DBT">KLD1F0510DBT... (3 Replies)
hello.
How to remove first word from line. The line may or may not start with blank.
NEW_PARAM1=$(magic-command " -t --protocol=TCP -P 12345-u root -h localhost ")
NEW_PARAM2=$(magic-command "-t --protocol=TCP -P 12345 -u root -h localhost ")
I want NEW_PARAM1 equal to NEW_PARAM2 equal ... (2 Replies)
Hello,
I could not remove brackets with text contents
myfile:
Please remove the bracket with text
I wish to remove:
I tried:
sed 's/\//' myfile
It gives:
Please remove the bracket with text A1
I expect:
Please remove the bracket with text
Many thanks
Boris (2 Replies)
Discussion started by: baris35
2 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)