Hi,
Need to extract a string from one file and search the same in other files.
Ex:
I have file1 of hundred lines with no delimiters not even space.
I have 3 more files.
I should get 1 to 10 characters say substring from each line of file1 and search that string in rest of the files and get... (1 Reply)
I need to search for a specific string in a file and if this string exist I need to replace it with something else. I am not sure how I could do this, using an if statement. (2 Replies)
Hi people. I am new to shell scripting, so I need a little help. I want to create a script named that takes an argument as a file, Read the input file and look for occurrences of the current username (say abc.xyz) who is executing the script. On finding an occurrence of the username take that line... (2 Replies)
Hi,
I am new to unix shell scripting.
I have a requirement.
Could anyone help me writing the script for the same?
Here goes the requirement:
I have a config file let's say temp.config.
Here is the data in the config file
temp.config :
-------------
name=victor
age=42
state=texas... (5 Replies)
Hi Guys...
I want to search for each file that contains a particular string.
e.g find . -print | xargs grep -i string_name
Now my issue is the files that I search in are gzipped.
Will I be able to find the string, using the above commands, even if the files are gzipped?
Please... (2 Replies)
Hi all.
I have the following command that is successfully searching for any one of the strings on all lines of a file and replacing it with the instructed value.
cat inputFile | awk '{gsub(/aaa|bbb|ccc|ddd/,"1234")}1' > outputFile
This does in fact replace any occurrence of aaa, bbb,... (2 Replies)
Hi,
I have a requirement where I need to replace a string in a line and this line will be identified by search criteria on previous line:
E.g.:
I have an xml file and Contents as below:
<Root>
<NameValue>
<name>Global/Text/Data</name>
<value>This is valid... (14 Replies)
Hello,
I have a file name like FIRST_DPF_DAILY_CUST_0826152322.txt
i need to extract the string after the third "_" underscore upto timestamp ends i.e CUST_0826152322
can anyone help me with the code
Thank you!
Regards
Srikanth Sagi (3 Replies)
Hi
I have a large txt file on my AIX server and I need to replace some text using two other files. So filename1 has about 500 lines similar to:
txtcode SYStem100
I have the string I want to change in string2 and the new stringname in string3. Does anyone know a way of doing this? I have... (1 Reply)
I am trying to read a value from a mapping file and would need to replace the value based on country parameter
source_table_@ctry_final
Expected
final_var=source_table_aus_final
If the country is in nz,usa,uk then
final_var=diff_table_nz_final
final_var=diff_table_usa_final
like that... (10 Replies)
Discussion started by: Master_Mind
10 Replies
LEARN ABOUT PHP
mb_convert_encoding
MB_CONVERT_ENCODING(3) 1 MB_CONVERT_ENCODING(3)mb_convert_encoding - Convert character encodingSYNOPSIS
string mb_convert_encoding (string $str, string $to_encoding, [mixed $from_encoding = mb_internal_encoding()])
DESCRIPTION
Converts the character encoding of string$str to $to_encoding from optionally $from_encoding.
PARAMETERS
o $str
- The string being encoded.
o $to_encoding
- The type of encoding that $str is being converted to.
o $from_encoding
- Is specified by character code names before conversion. It is either an array, or a comma separated enumerated list. If
$from_encoding is not specified, the internal encoding will be used. See supported encodings.
RETURN VALUES
The encoded string.
EXAMPLES
Example #1
mb_convert_encoding(3) example
<?php
/* Convert internal character encoding to SJIS */
$str = mb_convert_encoding($str, "SJIS");
/* Convert EUC-JP to UTF-7 */
$str = mb_convert_encoding($str, "UTF-7", "EUC-JP");
/* Auto detect encoding from JIS, eucjp-win, sjis-win, then convert str to UCS-2LE */
$str = mb_convert_encoding($str, "UCS-2LE", "JIS, eucjp-win, sjis-win");
/* "auto" is expanded to "ASCII,JIS,UTF-8,EUC-JP,SJIS" */
$str = mb_convert_encoding($str, "EUC-JP", "auto");
?>
SEE ALSO mb_detect_order(3).
PHP Documentation Group MB_CONVERT_ENCODING(3)