10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
I have a multicolumn text file with header in the first row like this
The headers are stored in an array called . which contains I want to search for each elements of this array from that multicolumn text file. And I am using this awk approach
for ii in ${hdr}
do
gawk -vcol="$ii" -F... (1 Reply)
Discussion started by: Atta
1 Replies
2. UNIX for Beginners Questions & Answers
I am trying to figure out to find word count of each word from my file
sample file
hi how are you
hi are you ok
sample out put
hi 1
how 1
are 1
you 1
hi 1
are 1
you 1
ok 1
wc -l filename is not helping , i think we will have to split the lines and count and then print and also... (4 Replies)
Discussion started by: mirwasim
4 Replies
3. Shell Programming and Scripting
Hi,
I have a sample file as shown below, I am looking for sed or any command which prints the complete word only from the input file.
Ex:
$ cat "sample.log"
I am searching for a word which is present in this file
We can do a pattern search using grep but I need to cut only the word which... (1 Reply)
Discussion started by: mohan_kumarcs
1 Replies
4. Shell Programming and Scripting
I have a file input.txt which have loads of weird characters, html tags and useful materials. I want to display 35 characters after the word "description" excluding weird characters like $&lmp and without html tags in the new file output.txt. Help me. Thanx in advance. I have attached the input... (4 Replies)
Discussion started by: sachit adhikari
4 Replies
5. Shell Programming and Scripting
I have a file input.txt which have loads of weird characters, html tags and useful materials. I want to display 35 characters after the word description excluding weird characters like $$#$#@$#@***$# and without html tags in the new file output.txt. Help me. Thanx in advance.
My final goal is to... (11 Replies)
Discussion started by: sachit adhikari
11 Replies
6. UNIX for Dummies Questions & Answers
Hi, i am new to unix shell scripting and i need a script which would search for a particular word in all the files present in a directory. The output should have the word and file path name. For example: "word" "path name".
Thanks for the reply in adv,:) (3 Replies)
Discussion started by: virtual_45
3 Replies
7. Shell Programming and Scripting
Hi,
I have to search a word in a text file and then I have to delete lines above from the word searched . For eg suppose the file is like this:
Records
P1
10,23423432
,77:1
,234:2
P2
10,9089004
,77:1
,234:2
,87:123
,9898:2
P3
456456
P1
:123,456456546
P2
abc:324234 (2 Replies)
Discussion started by: vsachan
2 Replies
8. Shell Programming and Scripting
Im currently working on a Script using PICO editor, the scripts purpose is :
When you typed a certain "word" and press enter, All directories, Script, and any other files that contain that "word" will be displayed.. for example i typed "DOG".. all executable script, Directories, and any other... (3 Replies)
Discussion started by: jenimesh19
3 Replies
9. Shell Programming and Scripting
Hi,
Now i work in a code that
1-get data stored in the database in the form of hash table with a key
field which is the " Name"
2-in the same time i open a txt file and loop through it word by word
3- which i have a problem in is that :
I need to loop word by word and check if it is a... (0 Replies)
Discussion started by: eng_shimaa
0 Replies
10. Shell Programming and Scripting
Hi fiends,
I need some help.
i have a var called fname="req_detail_TAM.dat"
and is have a search string var as tmp="TAM".
Now my requirement is i need to check whether a "fname" is contains "search str" or not. if search string is part of the filename, then i need to store value 1 in a... (2 Replies)
Discussion started by: manu.vmr
2 Replies
ADDSLASHES(3) 1 ADDSLASHES(3)
addslashes - Quote string with slashes
SYNOPSIS
string addslashes (string $str)
DESCRIPTION
Returns a string with backslashes before characters that need to be escaped. These characters are single quote ( '), double quote ( "),
backslash ( ) and NUL (the NULL byte).
An example use of addslashes(3) is when you're entering data into string that is evaluated by PHP. For example, O'Reilly is stored in
$str, you need to escape $str. (e.g. eval("echo '".addslashes($str)."';"); )
To escape database parameters, DBMS specific escape function (e.g. mysqli_real_escape_string(3) for MySQL or pg_escape_literal(3),
pg_escape_string(3) for PostgreSQL) should be used for security reasons. DBMSes have differect escape specification for identifiers (e.g.
Table name, field name) than parameters. Some DBMS such as PostgreSQL provides identifier escape function, pg_escape_identifier(3), but not
all DBMS provides identifier escape API. If this is the case, refer to your database system manual for proper escaping method.
If your DBMS doesn't have an escape function and the DBMS uses to escape special chars, you might be able to use this function only when
this escape method is adequate for your database. Please note that use of addslashes(3) for database parameter escaping can be cause of
security issues on most databases.
The PHP directive magic_quotes_gpc was on by default before PHP 5.4, and it essentially ran addslashes(3) on all GET, POST, and COOKIE
data. Do not use addslashes(3) on strings that have already been escaped with magic_quotes_gpc as you'll then do double escaping. The func-
tion get_magic_quotes_gpc(3) may come in handy for checking this.
PARAMETERS
o $str
- The string to be escaped.
RETURN VALUES
Returns the escaped string.
EXAMPLES
Example #1
An addslashes(3) example
<?php
$str = "Is your name O'Reilly?";
// Outputs: Is your name O'Reilly?
echo addslashes($str);
?>
SEE ALSO
stripcslashes(3), stripslashes(3), addcslashes(3), htmlspecialchars(3), quotemeta(3), get_magic_quotes_gpc(3).
PHP Documentation Group ADDSLASHES(3)