Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-build-utils
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
korinf
etersoft-build-utils
Commits
6c03b6b2
Commit
6c03b6b2
authored
Jun 16, 2010
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add remove_from_list and regexp_exclude_list with regexp support
parent
02adfdd7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
6 deletions
+32
-6
strings
share/eterbuild/functions/strings
+32
-6
No files found.
share/eterbuild/functions/strings
View file @
6c03b6b2
...
@@ -5,27 +5,53 @@
...
@@ -5,27 +5,53 @@
filter_strip_spaces
()
filter_strip_spaces
()
{
{
# possible use just
#xargs echo
sed
-e
"s|
\+
| |g"
|
\
sed
-e
"s|
\+
| |g"
|
\
sed
-e
"s|^ ||"
|
sed
-e
"s|
\$
||"
sed
-e
"s|^ ||"
|
sed
-e
"s|
\$
||"
}
}
strip_spaces
()
strip_spaces
()
{
{
echo
$@
| filter_strip_spaces
echo
"
$*
"
| filter_strip_spaces
}
# remove_from_list "1." "11 12 21 22" -> "21 22"
remove_from_list
()
{
local
i
local
RES
=
for
i
in
$2
;
do
echo
"
$i
"
|
grep
-q
-w
"
$1
"
||
RES
=
"
$RES
$i
"
done
strip_spaces
"
$RES
"
}
}
# Args: LIST1 LIST2
# Args: LIST1 LIST2
# do_exclude_list print LIST2 with field contains in LIST1
# do_exclude_list print LIST2 exclude fields contains also in LIST1
# Example: do_exclude_list "1 3" "1 2 3 4" -> "2 4"
do_exclude_list
()
do_exclude_list
()
{
{
local
i
local
i
local
RES
=
local
RES
=
for
i
in
$2
;
do
for
i
in
$2
;
do
echo
"
$1
"
|
grep
-q
-w
$i
||
RES
=
"
$RES
$i
"
echo
"
$1
"
|
grep
-q
-w
"
$i
"
||
RES
=
"
$RES
$i
"
done
done
echo
$RES
| filter_strip_spaces
strip_spaces
"
$RES
"
}
}
# regexp_exclude_list "22 1." "11 12 21 22" -> "21"
regexp_exclude_list
()
{
local
i
local
RES
=
"
$2
"
for
i
in
$1
;
do
RES
=
$(
remove_from_list
"
$i
"
"
$RES
"
)
done
strip_spaces
"
$RES
"
}
# drop listed options
# drop listed options
# FIXME: do not handle args like -Uh, only -U -h separately
# FIXME: do not handle args like -Uh, only -U -h separately
drop_args
()
drop_args
()
...
@@ -40,7 +66,7 @@ drop_args()
...
@@ -40,7 +66,7 @@ drop_args()
initial_letter
()
initial_letter
()
{
{
echo
$
1
|
cut
-c1
echo
"
$1
"
|
head
-n
1
|
cut
-c1
}
}
is_dirpath
()
is_dirpath
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment