Search Results

Search: Posts Made By: kristinu
2,845
Posted By bakunin
Yes, but it would be cumbersome and plain ugly....
Yes, but it would be cumbersome and plain ugly. Writing scripts (i suppose you need it in a script) is all about clarity and making it easy to understand what is done, therefore you should do it in...
2,845
Posted By Don Cragun
You have already shown us that you know how to...
You have already shown us that you know how to get what you want:
text="iv-hhz-sac/hpac/hhz.d/iv.hpac..hhz.d.2016.250.070018.sac"
result=${text%.*}
result=${result##*/}
printf '%s\n' "$result"...
969
Posted By Don Cragun
Why do you think that is a funny thing??? By...
Why do you think that is a funny thing??? By definition, a continuation backslash is a <backslash> character IMMEDIATELY followed by a <newline> character. If there is any character between a...
2,887
Posted By RudiC
Why not printf "%02d:%02d:%02d\n" $((25793 /...
Why not
printf "%02d:%02d:%02d\n" $((25793 / 3600)) $((25793 % 3600 / 60 )) $((25793 % 3600 % 60))
07:09:53Please be aware that bashcan do integer calculations only! If you need fractions of...
1,557
Posted By Don Cragun
You have started well over 300 threads in the...
You have started well over 300 threads in the last seven years. You know what is needed for us to be able to help you efficiently:

The operating system you're using (which you have not...
1,878
Posted By Chubler_XL
The white box is probably you input cursor you...
The white box is probably you input cursor you can hide/view it like this:

# Counts the number of files to process
totfcn=$(find . -type f | tee /tmp/wrk | wc -l)

# Hide cursor
tput civis
...
2,575
Posted By Don Cragun
Your code uses command substitution (i.e.,...
Your code uses command substitution (i.e., $(command arguments)). That involves forking a shell, executing command, waiting for command to finish, reading the results from command, and assigning...
2,575
Posted By Don Cragun
First, I suggested using find $PWD ...; not find...
First, I suggested using find $PWD ...; not find $pwd .... Your shell sets PWD to an absolute pathname of your current working directory when it starts up and updates it every time you successfully...
2,575
Posted By Don Cragun
Have you considered using an absolute pathname on...
Have you considered using an absolute pathname on the find (i.e. find "$PWD" ... instead of find . ...) and moving to the directory in which you want the files to be created before invoking mseed2sac...
1,878
Posted By Don Cragun
The command: i=$((i++)) does the following...
The command:
i=$((i++))
does the following things, in sequence:

$((i++)) part 1: save the initial value of i,
$((i++)) part 2: increment the value of i,
$((i++)) part 1: return the...
1,216
Posted By Scott
I don't really follow you. Nothing will be lost...
I don't really follow you. Nothing will be lost with 'mkdir', despite your earlier assertion that "I think that `mkdir -p` overwrites the directories. I want to avoid that". mkdir doesn't do anything...
1,216
Posted By milhan
mkdir -p will create intermediary directories...
mkdir -p will create intermediary directories only as necessary. That is, it won't try to re-create it if the directory already exists.
1,359
Posted By Scrutinizer
Try: for i in sac_pzs_* do mv "$i"...
Try:
for i in sac_pzs_*
do
mv "$i" "${i#sac_pzs_}.sac.pzs"
done
2,077
Posted By RudiC
Can't be done with grep alone; either deploy...
Can't be done with grep alone; either deploy precursor or trailing commands, or use e.g. awk or sed to start matching at your target line downwards:
sed -n '/@unnumbered References/,$ {/some...
2,316
Posted By RudiC
Wouldn't you need to account for the archives...
Wouldn't you need to account for the archives being gzipped; either by gunzipping them first or by adding the -z option to tar.
2,316
Posted By Scrutinizer
Try something like this? find "$(pwd)" -type d...
Try something like this?
find "$(pwd)" -type d |
while read dir
do
cd "$dir" || continue
for archive in *.tar.gz
do
if [ -r "./$archive" ]; then
tar zxf "./$archive"
fi
...
4,703
Posted By Aia
Please, follow the first set of instructions if...
Please, follow the first set of instructions if you can now, using chroot. That's a bit safer.
If not, try the last resort option of blowing the password, manually.
1,254
Posted By Scrutinizer
Instead of else if, use elif, then it should...
Instead of else if, use elif, then it should work, provided you use a lowercase T in then and you use spaces around the square brackets...
1,254
Posted By RudiC
How about ls | while read FN; do NE=${FN%.*};...
How about ls | while read FN; do NE=${FN%.*}; echo mv ${FN} ${NE##*_}_${FN%_*}${FN#${NE}}; done
mv roman_pottery_in_the_archaeological_record_2007.pdf...
Forum: Programming 12-08-2014
2,524
Posted By wbport
Some other features to consider: Enter...
Some other features to consider:


Enter an initial time for both players.
Count backwards.
Stop both clocks (tournament director resolving problem).
Resume.
Forum: Programming 10-21-2014
8,214
Posted By Corona688
Or, to turn that around: Would you want...
Or, to turn that around:

Would you want people to be able to do that to you? Run completely anonymous code which can't be tracked, analyzed, controlled, accounted, reviewed, or trusted in any...
2,154
Posted By Chubler_XL
You could also try something like this: ...
You could also try something like this:

#!/bin/bash

files=$(find . -name "kay.even*.png.pdf")

num=2001
for fl in $files
do
prefix=${fl%%[0-9]*}
suffix=${fl##*[0-9]}
((num+=2))...
Forum: Programming 04-19-2014
1,638
Posted By Don Cragun
The echo commands are not your problem. There is...
The echo commands are not your problem. There is a huge difference between:
test : $(mn)/getvel_main.cpp
$(C++) $(OPT) $(DEF) $(IDIR) $(mn)/getvel_main.cpp -o getvel
-mv getvel ./gbinand:...
1,128
Posted By Don Cragun
It would be safer to use: awk -v s="/geopdf/"...
It would be safer to use:
awk -v s="/geopdf/" -v d="/" '{gsub(s,d); print}' /home/chrisd/Desktop/geo1937/geo02n01.html
in case other directory names ending in "geopdf" could appear in your data.
Forum: Programming 02-09-2014
6,720
Posted By Akshay Hegde
itoa is not standard function, this function is...
itoa is not standard function, this function is not defined in ANSI-C and C++. So it's not supported by some compiler such as g++. better you create your own function to convert int to string and...
Showing results 1 to 25 of 81

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