09-15-2010
Quote:
rdcwayx is abbreviating "regular expression" as "reg".
rdcwayx is correctly suggesting that if you do a bit of searching around in these forums (using the search features) or research on the use of regular expressions, you will find the answer to your question quite easily.
My thanks to you. I'll do just that.
BZT
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Dear friends,
please tell me how to find the files which are existing in the current directory, but it sholud not search in the sub directories..
it is like this,
current directory contains
file1, file2, file3, dir1, dir2
and dir1 conatins
file4, file5
and dir2 contains
file6,... (9 Replies)
Discussion started by: swamymns
9 Replies
2. Shell Programming and Scripting
I am writing a expect script. during the expect, i need check the out to see whether i logged in:
set password "1234"
spawn telnet host1
expect "login:"
send "guest\n"
expect "password:"
send $password
expect -re "#|$"
puts "Logged in"
But it seems that expect takes "$" as a wild... (3 Replies)
Discussion started by: sleepy_11
3 Replies
3. Shell Programming and Scripting
find . -type f -print0 | xargs -0 chmod 600
find . -type f
On bash, I would like to pass the search result of "find" to another command as well as to the standard output. The above code performs the same search twice -- once for "xargs -0 chmod" and another for stdout. I would like to... (5 Replies)
Discussion started by: LessNux
5 Replies
4. Shell Programming and Scripting
I have a bunch of random character lines like ABCEDFG. I want to find all lines with "A" and then change any "E" to "X" in the same line. ALL lines with "A" will have an "X" somewhere in it. I have tried sed awk and vi editor. I get close, not quite there. I know someone has already solved this... (10 Replies)
Discussion started by: nightwatchrenba
10 Replies
5. UNIX for Dummies Questions & Answers
Hi All,
I'm completely new to bash scripting and still learning my way through albeit vey slowly.
I need to know where to insert my server names', my ip address numbers through out the script alas to no avail.
I'm also searching on how to save .sh (bash shell) script properly.... (25 Replies)
Discussion started by: profileuser
25 Replies
6. UNIX for Advanced & Expert Users
Hi, everyone.
I need to write a program to get io info based on libperfstat.
But the "write time" of a disk is just half of the value get from iostat.
I'm confused and can't explain. Help please.
How I calculate "write service time per sec":
In iostat:
write service... (0 Replies)
Discussion started by: jackliang
0 Replies
7. Shell Programming and Scripting
These three finds worked as expected:
$ find . -iname "*.PDF"
$ find . -iname "*.PDF" \( ! -name "*_nobackup.*" \)
$ find . -path "*_nobackup*" -prune -iname "*.PDF"
They all returned the match:
./folder/file.pdf
:b:
This find returned no matches:
$ find . -path "*_nobackup*" -prune... (3 Replies)
Discussion started by: wolfv
3 Replies
8. Shell Programming and Scripting
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
9. Shell Programming and Scripting
I need to find two matches in the output from ps. I am searching with ps -ef |grep mysql for:
my.cnf
/bin/sh /usr/bin/mysqld_safe --defaults-file=/data/mysql/master/agis_core/etc/my.cnf
after this match I want to search back and match the hostname which is x number of lines back, above the... (2 Replies)
Discussion started by: bash_in_my_head
2 Replies
LEARN ABOUT OSX
git-name-rev
GIT-NAME-REV(1) Git Manual GIT-NAME-REV(1)
NAME
git-name-rev - Find symbolic names for given revs
SYNOPSIS
git name-rev [--tags] [--refs=<pattern>]
( --all | --stdin | <commit-ish>... )
DESCRIPTION
Finds symbolic names suitable for human digestion for revisions given in any format parsable by git rev-parse.
OPTIONS
--tags
Do not use branch names, but only tags to name the commits
--refs=<pattern>
Only use refs whose names match a given shell pattern. The pattern can be one of branch name, tag name or fully qualified ref name. If
given multiple times, use refs whose names match any of the given shell patterns. Use --no-refs to clear any previous ref patterns
given.
--exclude=<pattern>
Do not use any ref whose name matches a given shell pattern. The pattern can be one of branch name, tag name or fully qualified ref
name. If given multiple times, a ref will be excluded when it matches any of the given patterns. When used together with --refs, a ref
will be used as a match only when it matches at least one --refs pattern and does not match any --exclude patterns. Use --no-exclude to
clear the list of exclude patterns.
--all
List all commits reachable from all refs
--stdin
Transform stdin by substituting all the 40-character SHA-1 hexes (say $hex) with "$hex ($rev_name)". When used with --name-only,
substitute with "$rev_name", omitting $hex altogether. Intended for the scripter's use.
--name-only
Instead of printing both the SHA-1 and the name, print only the name. If given with --tags the usual tag prefix of "tags/" is also
omitted from the name, matching the output of git-describe more closely.
--no-undefined
Die with error code != 0 when a reference is undefined, instead of printing undefined.
--always
Show uniquely abbreviated commit object as fallback.
EXAMPLE
Given a commit, find out where it is relative to the local refs. Say somebody wrote you about that fantastic commit
33db5f4d9027a10e477ccf054b2c1ab94f74c85a. Of course, you look into the commit, but that only tells you what happened, but not the context.
Enter git name-rev:
% git name-rev 33db5f4d9027a10e477ccf054b2c1ab94f74c85a
33db5f4d9027a10e477ccf054b2c1ab94f74c85a tags/v0.99~940
Now you are wiser, because you know that it happened 940 revisions before v0.99.
Another nice thing you can do is:
% git log | git name-rev --stdin
GIT
Part of the git(1) suite
Git 2.17.1 10/05/2018 GIT-NAME-REV(1)