Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: mirni
2,447
Posted By Don Cragun
Change: -name '*.jpg' -o -name '*.jpeg' -o...
Change:
-name '*.jpg' -o -name '*.jpeg' -o -name '*.gif' -o -name '*.png'to:
\( -name '*.jpg' -o -name '*.jpeg' -o -name '*.gif' -o -name '*.png' \)
3,474
Posted By Don Cragun
It is even more efficient to leave xargs out of...
It is even more efficient to leave xargs out of the mix and let find invoke chmod with multiple operands by using + instead of \; to terminate the list of -exec arguments:
find /local/home/app/cases...
Forum: Programming 02-12-2014
1,495
Posted By jim mcnamara
On a whole lot less imaginative vector: 6...
On a whole lot less imaginative vector:

6 Linux Interprocess Communications (http://www.tldp.org/LDP/lpg/node7.html)

There are umpteen different IPC mechanisms. -- basically: semaphores,...
Forum: Programming 02-12-2014
1,495
Posted By Don Cragun
The parent application can set up standard output...
The parent application can set up standard output of the shell script to be the write end of a pipe that the parent can use to read status from the child.

The parent can create a named pipe (or...
2,407
Posted By alister
Substitute character...
Substitute character (http://en.wikipedia.org/wiki/Substitute_character) aka Control-Z (http://en.wikipedia.org/wiki/Control-Z) (suspends in UNIX, EOF in DOS).

Regards,
Alister
11,428
Posted By Scrutinizer
@mirni. That would work in this case, but if if...
@mirni. That would work in this case, but if if there is also text that begins with a non-digit then as space would be inserted at the start of the line.. To avoid that one could use:
sed...
1,459
Posted By anbu23
Along with mirni's change, you have to add quotes...
Along with mirni's change, you have to add quotes
if [[ "$status" = "successfully completed" ]]
2,664
Posted By Scrutinizer
Thanks :) It later crossed my mind that it could...
Thanks :) It later crossed my mind that it could be reduced a bit further still:
awk 'NR==FNR{A[$1]=$0; next} $1=A[$1]' file1 FS=, OFS='\t' file2
1,490
Posted By elixir_sinari
Shouldn't perl -pie be perl -pi -e?
Shouldn't perl -pie be perl -pi -e?
2,359
Posted By alister
What you say about mkdir -p is correct, but you...
What you say about mkdir -p is correct, but you misunderstood the code. The else-clause has nothing to do with mkdir, but with the directory test above it.




It could fail because the...
14,123
Posted By alister
That's incorrect. When an executable file's...
That's incorrect. When an executable file's header/magic isn't recognized, it is passed to /bin/sh regardless of the user's shell.

Note that this behavior (falling back on /bin/sh) is only...
14,123
Posted By alister
True. With regard to the original post, if...
True.

With regard to the original post, if the script is sourced, even if the shebang is present, it is never used.

Regards,
Alister

---------- Post updated at 10:02 AM ---------- Previous...
3,437
Posted By Corona688
Fixed that for you. Not all Bourne shells...
Fixed that for you.

Not all Bourne shells are BASH. BASH is a Bourne shell, with extended features that a generic Bourne shell doesn't have -- like arrays, and functions.

There is also more...
1,742
Posted By alister
As far as I know, every major AWK implementation...
As far as I know, every major AWK implementation treats FS as a regular expression when it consists of more than one character (it's required by POSIX).

Regards,
Alister
Forum: Programming 07-05-2012
5,958
Posted By methyl
Try the unix file command on each file.
Try the unix file command on each file.
985
Posted By Scrutinizer
You can also set IFS local to the read command,...
You can also set IFS local to the read command, then you do no need to record and reinstate the old IFS value:
while IFS=, read string
do
set -- $string
done < inputfile

You need to use...
3,050
Posted By Scrutinizer
Note: \< an \> are GNU extensions.. -- ...
Note: \< an \> are GNU extensions..


--
awk version:
awk '{for(i=1;i<=NF;i++)if(toupper($i)==s)$i=s}1' FS=\| OFS=\| s=USE infile
3,050
Posted By zaxxon
You specify a "word" with the pointed brackets. ...
You specify a "word" with the pointed brackets.
Check this out:
GREP for Linguists (http://arts.anu.edu.au/linguistics/misc/comp_resources/grep.html)
See 2.1, Trick #2.
3,050
Posted By zaxxon
# sed 's/\<[sS][eE][U]\>/USE/g' s_sample.txt ...
# sed 's/\<[sS][eE][U]\>/USE/g' s_sample.txt
grant permission to all user
sts|ln|USE|PSG
sajncht|se|USE|PPSPSG
psg|ln|USE|TSPSG
sts_user.Me revoke
1,431
Posted By Scott
Do you have a free USB port? This works for me......
Do you have a free USB port? This works for me...

https://www.unix.com/members/scott-albums-stuff-picture467-usb-memory-bomb.jpg

You must really start reading man pages and start to make an...
3,258
Posted By Scrutinizer
Hi pravin, The '-flag is not in the POSIX...
Hi pravin,

The '-flag is not in the POSIX specification of the printf utility itself:printf utility: extended description...
33,794
Posted By Chubler_XL
How about this: awk 'function repl(s,f,t,v)...
How about this:

awk 'function repl(s,f,t,v)
{ return substr(s,1,f-1) sprintf("%-*s", t-f+1, v) substr(s,t+1) }
{ a=repl($0,96,98,"ABC")
a=repl(a,99,113,"DEF")
a=repl(a,190,198,"XYZ")
...
3,818
Posted By Scrutinizer
The global flag would not help you there because...
The global flag would not help you there because the _.* makes sure that everything after and including the underscore gets wiped out... In that case you would need to do something like this:
sed...
1,703
Posted By daPeach
an array seems useless in this casefor (( x=1;...
an array seems useless in this casefor (( x=1; x<=365; x++)); do printf -v maVar '%.2d' $x; command >1999$maVar; done
btw, arithmetic expansion is done inside array elements without the need of...
1,946
Posted By Scrutinizer
Hi, AFAIK only gawk and mawk allow RS to have...
Hi, AFAIK only gawk and mawk allow RS to have more than one character. The POSIX specification states that only the first character of the string value of RS should be used as input record separator,...
Showing results 1 to 25 of 50

 

Featured Tech Videos

All times are GMT -4. The time now is 08:25 PM.
Unix & Linux Forums Content Copyright 1993-2021. All Rights Reserved.
Privacy Policy