Hi,
I'm trying to do the following , I have certain variables in a file and then I want to check for these variables in a certain cobol file to see if they contain a certain package if so replace them with value 1 but but that last line is giving problems:
# for each variable in SQL file
... (1 Reply)
Hi,
I'm trying to do the following , I have certain variables in a file and then I want to check for these variables in a certain cobol file to see if they contain a certain package if so replace them with value 1 but but that last line is giving problems:
# for each variable in SQL file
... (1 Reply)
Hi guys,
I want to replace certain values with the number 1.
But it is also replacing other values which contain the value I want to replace. e.g.:
I want to replace ID-INTERNAL with 1, that's no problem but it will also replace ID-INTERNAL-NON-REM with 1-NON-REM
I don't want to... (10 Replies)
when i do something like substituting a particular thing with a system variable, i am unable to do that expect the varible name getting into that.
for ex.. i tried,
sed -e 's/date/`date`/g' <if >of
but i got date replaced with "`date`" and not with the actual date ..
same case happened... (5 Replies)
Hi,
I'm trying to use sed to delete the last three lines of a file. I currently have:
# get the amount of lines in the file
foldernum=`wc -l File_In.txt | cut -c1-8`
# remove the lines in the file
sed "${foldernum}-3,${foldernum}d" File_In.txt > File_Out.txt
I get the error - sed:... (5 Replies)
I'm trying to get sed to cut and replace using variables, but it doesnt seem to work, when I run this the mod time of the file does get updated. Is my syntax incorrect in the sed command?
Thanks
#!/usr/bin/ksh
#Modify header
set -x
HEAD=$(cat PBN2CPR1.TXT | awk 'BEGIN { FS = ","... (1 Reply)
Hi,
I am able to use sed if I hardcode the find and replace values in a shell script.
This works:
sed -e 's/123v/4567/g' /path/aaa.txt
> /path/aaa.txt.tmp
If I use a variable, I am not able to use sed command. why?
This doesnot work:
i=abc
j=bk${i}
sed -e 's/${i}/${j}/g'... (5 Replies)
All
I am trying to produce the following in /etc/ssh/sshd_config,
# IPv4 only
#ListenAddress 0.0.0.0
# IPv4 & IPv6
ListenAddress ::
to
# IPv4 only
ListenAddress <user-entry>
ListenAddress <user-entry>
# IPv4 & IPv6
#ListenAddress ::
The number of user entries can vary.
... (1 Reply)
Im trying to use sed to print value that matches the value in variable and all lines after that.
grep "Something" test.txt | sed -e '/{$variable}/,$b' -e 'd'
I cant get it work, if I replace the $variable with the value it contains, it works fine... (10 Replies)
Discussion started by: olkkis
10 Replies
LEARN ABOUT PHP
glob
GLOB(3) 1 GLOB(3)glob - Find pathnames matching a patternSYNOPSIS
array glob (string $pattern, [int $flags])
DESCRIPTION
The glob(3) function searches for all the pathnames matching $pattern according to the rules used by the libc glob() function, which is
similar to the rules used by common shells.
PARAMETERS
o $pattern
- The pattern. No tilde expansion or parameter substitution is done.
o $flags
- Valid flags:
o GLOB_MARK - Adds a slash to each directory returned
o GLOB_NOSORT - Return files as they appear in the directory (no sorting). When this flag is not used, the pathnames are
sorted alphabetically
o GLOB_NOCHECK - Return the search pattern if no files matching it were found
o GLOB_NOESCAPE - Backslashes do not quote metacharacters
o GLOB_BRACE - Expands {a,b,c} to match 'a', 'b', or 'c'
o GLOB_ONLYDIR - Return only directory entries which match the pattern
o GLOB_ERR - Stop on read errors (like unreadable directories), by default errors are ignored.
RETURN VALUES
Returns an array containing the matched files/directories, an empty array if no file matched or FALSE on error.
Note
On some systems it is impossible to distinguish between empty match and an error.
CHANGELOG
+--------+--------------------+
|Version | |
| | |
| | Description |
| | |
+--------+--------------------+
| 5.1.0 | |
| | |
| | |
| | GLOB_ERR was added |
| | |
+--------+--------------------+
EXAMPLES
Example #1
Convenient way how glob(3) can replace opendir(3) and friends.
<?php
foreach (glob("*.txt") as $filename) {
echo "$filename size " . filesize($filename) . "
";
}
?>
The above example will output something similar to:
funclist.txt size 44686
funcsummary.txt size 267625
quickref.txt size 137820
NOTES
Note
This function will not work on remote files as the file to be examined must be accessible via the server's filesystem.
Note
This function isn't available on some systems (e.g. old Sun OS).
Note
The GLOB_BRACE flag is not available on some non GNU systems, like Solaris.
SEE ALSO opendir(3), readdir(3), closedir(3), fnmatch(3).
PHP Documentation Group GLOB(3)