大约有 800 项符合查询结果(耗时:0.0162秒) [XML]
Rename multiple files based on pattern in Unix
...
rename 's/^fgh/jkl/' fgh*
Real pretty, but rename is not present on BSD, which is the most common unix system afaik.
rename fgh jkl fgh*
ls | perl -ne 'chomp; next unless -e; $o = $_; s/fgh/jkl/; next if -e; rename $o, $_';
If you insist on using Perl, but there is no rename on your system, ...
How to check if a symlink exists
...
According to the GNU manpage, -h is identical to -L, but according to the BSD manpage, it should not be used:
-h file True if file exists and is a symbolic link. This operator is retained for compatibility with previous versions of this program. Do not rely on its existence; use -L inste...
How can I search for a multiline pattern in a file?
... experimental and grep -P may warn of unimplemented features. Of course in BSD grep it's not there at all. Would be nice if it wasn't so experimental but it's nice to be reminded of it - little though I'm likely to use it.
– Pryftan
Sep 23 '19 at 0:10
...
grep a file, but show several surrounding lines?
...
For BSD or GNU grep you can use -B num to set how many lines before the match and -A num for the number of lines after the match.
grep -B 3 -A 2 foo README.txt
If you want the same number of lines before and after you can use ...
Set up a scheduled job?
...
BSD, Mac, and any Unix-like OS have cron.
– DylanYoung
Sep 3 '16 at 16:26
add a comment
...
How to make a transparent UIWebView
... these properties in Interface Builder will work for iOS 5.0+, but for iOS 4.3 you must set the backgroundColor in code)
And include this into your HTML code:
<body style="background-color: transparent;">
share
...
Total size of the contents of all the files in a directory [closed]
...
yeah, good point. if it wasn't in bsd 4.2 I don't remember to use it :-(
– Nelson
Aug 6 '09 at 22:24
3
...
Read each line of txt file to new array element
...e. Even PHP stores the content of parsed files. I mean, we're far from PHP 4.3
– Yanick Rochon
Jul 16 at 2:32
add a comment
|
...
Match two strings in one line with grep
...
At least on OS-X and FreeBSD it does work! My guess is you're on something else (which the OP didn't define - hope you didn't downvote a correct answer to many users except you).
– Leo
Jul 23 '15 at 7:27
...
How can I get the current user's username in Bash?
...
Use the standard Unix/Linux/BSD/MacOS command logname to retrieve the logged in user. This ignores the environment as well as sudo, as these are unreliable reporters. It will always print the logged in user's name and then exit. This command has been ar...