Search Results

Search: Posts Made By: f77hack
1,413
Posted By Chubler_XL
Using bash and depending on how big the...
Using bash and depending on how big the somefiles[] is (don't want to blow out the command line):

gfind . \( -false ${somefiles[@]/#/-o -name } \) -type f ...
1,413
Posted By bakunin
I think what Don is trying to tell you is: this...
I think what Don is trying to tell you is: this command

gfind . -depth -name "somefile" -type f -writable

will find some list of files. Since it is repeated eleven times it will find (and hence...
1,413
Posted By Don Cragun
Just to be clear, is it true that you want the...
Just to be clear, is it true that you want the output of the sed from the 1st find to be written to standard output (and not be included in the changes made to updated files) while all of the other...
1,563
Posted By rdrtx1
gnu? string='# -*- coding: utf-8; mode: tcl;...
gnu?
string='# -*- coding: utf-8; mode: tcl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -\\*- vim:fenc=utf-8:ft=tcl:et:sw=2:ts=2:sts=2'

sed -i '1{/^#./! s/.*/'"$string"'/}' test.tcl
1,577
Posted By jim mcnamara
My opinion: As a general solution that seems...
My opinion:

As a general solution that seems fine. I have not validated it. Are you encountering performance problems?
BTW the PCRE regex is very well optimized and is regex-directed, so you...
1,117
Posted By RudiC
You can cram all the sed commands into one...
You can cram all the sed commands into one script:
sed 's/.../.../g; s/.../.../g; s/.../.../g' file
Are those back references really necessary, e.g. to discriminate possible duplicates? If not, try...
Forum: Programming 03-23-2018
2,292
Posted By MadeInGermany
The recursion seems strange. Better go for an...
The recursion seems strange.
Better go for an iteration: an outer loop with counter, and two loops inside (one fwd then one bk).
BTW this is not shell code...
Forum: Programming 03-23-2018
2,292
Posted By stomp
#!/bin/bash max=5 next() { [...
#!/bin/bash

max=5

next() {
[ $counter -eq 0 ] || [ -z "$last" ] && change="1"
[ $counter -eq $max ] && change="-1"
last=$counter
((counter=$counter + $change))...
Forum: Programming 03-23-2018
2,292
Posted By rbatte1
Maybe you could have an adjustment value that you...
Maybe you could have an adjustment value that you would always add. When the counter gets high, you set the adjustment value to -1. When it gets back to zero, you set it to 1. That way, you only...
Forum: Programming 03-23-2018
2,292
Posted By RudiC
That spec is beyond me. Mayhap others, with some...
That spec is beyond me. Mayhap others, with some assumptions on e.g. shell and data structure, find a sensible interpratation of what you write.

For an index not to exceed array boundaries the...
8,229
Posted By RudiC
Speeding up could be done by NOT executing a bash...
Speeding up could be done by NOT executing a bash shell with command / function for every single file name found. Have find write all file names to a temp file, and read that in a while loop, callig...
8,229
Posted By MadeInGermany
What line do you search for, searchstring or...
What line do you search for,
searchstring or addstring or both?
What to do in which case?
Your function looks only for searchstring and adds addstring behind it.
But the subject and text says a...
1,420
Posted By MadeInGermany
With another separator we don't need to \/ each...
With another separator we don't need to \/ each literal /
As classic multi-line (\ plus newline instead of gsed-only \n)
sed 's#public func[^)]*)#///&\
//==mark==&\
&#' t
1,420
Posted By RudiC
Right parenthesis seems better, thanks Bakunin....
Right parenthesis seems better, thanks Bakunin. Try also
sed 's/public func[^)]*)/\/\/&\n\/\/==mark==&\n&/' file
//public func <<<T>(array: [T], offset: Int)
//==mark==public func <<<T>(array:...
1,420
Posted By bakunin
judging from your example outcome you perhaps...
judging from your example outcome you perhaps mean right bracket yes:

///public func <<<T>(array: [T], offset: Int)
//==mark==public func <<<T>(array: [T], offset: Int)
public func...
1,420
Posted By RudiC
Where would you locate the "first left...
Where would you locate the "first left parenthesis"?
1,384
Posted By Corona688
sed, bash, perl, awk, find, grep are all...
sed, bash, perl, awk, find, grep are all processes. A subshell is a process. A fork is a fork is a fork.

Whether any of these are faster or slower than other ways to solve your problem, really...
1,264
Posted By RudiC
If those actions are somehow file size dependent,...
If those actions are somehow file size dependent, and you supply the accurate dependency algorithm, people might be able to help you develop a formula to calculate a "time percentage" or "time to...
1,264
Posted By Chubler_XL
If you happy with Percent complete being accurate...
If you happy with Percent complete being accurate to within 1% you can also save spawning bc like replace this:

tot=$(printf "%s\n" *.${src_ext} | wc -l)
for i in `ls *.${src_ext} | sort -k2 -t_...
1,264
Posted By RudiC
ls -l is overdone here - you don't need the extra...
ls -l is overdone here - you don't need the extra fields in a long listing. tot=$(echo *.${src_ext} | wc -w) may save you a few CPU cycles.

Unless you tell people if and how "lots of stuff that...
1,494
Posted By Corona688
find `pwd` is a bit redundant, find . would do ...
find `pwd` is a bit redundant, find . would do

How about:

find . -depth -name .git -type d | while read DIR
do
(
cd "$DIR" && git stash && git pull && git submodule...
22,665
Posted By Don Cragun
Maybe you should ask a different question. Why...
Maybe you should ask a different question. Why are you defining options to be applied to every invocation of grep you make in your .bashrc file if you don't want those options to be applied every...
22,665
Posted By RudiC
You can define shell variables temporarily for...
You can define shell variables temporarily for just the next command:GREP_OPTIONS= command
3,345
Posted By RudiC
Not too clear what you expect. How about S=(0 1 2...
Not too clear what you expect. How about S=(0 1 2 3)
H=(A B C D E F G H I J K)
while [ ${#SX[@]} -lt ${#H[@]} ]; do SX=(${SX[@]} ${S[@]}); done
for ((i=${#H[@]}; i<=${#SX[@]}; i++)); do unset...
Showing results 1 to 24 of 24

 
All times are GMT -4. The time now is 12:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy