Search Results

Search: Posts Made By: apmcd47
609
Posted By apmcd47
Okay, sorry about that. I've gotten used to the...
Okay, sorry about that. I've gotten used to the GNU tr which does allow that behaviour. Now I've checked with Solaris I see your're right.

Andrew
609
Posted By apmcd47
This? printf "%s\n" $( tr -s ' ,.!?' ' '...
This?
printf "%s\n" $( tr -s ' ,.!?' ' ' <file_name)
server1
server2
server3
server4
server5
server6

tr turns all the expected delimiters to spaces and printf prints one per line.

Andrew
1,146
Posted By apmcd47
As I said in my earlier post you will have to see...
As I said in my earlier post you will have to see if you have a way to convert to text, such as "Edit Text and Images" menu option in Acrobat.

Andrew
1,146
Posted By apmcd47
This is probably a stupid question, but is your...
This is probably a stupid question, but is your PDF rendering text or an image, such a a scanned-in page, or text rendered to an image before being imported into the PDF? I'm not quite sure how you...
819
Posted By apmcd47
You don't say what system you are running this...
You don't say what system you are running this on. Assuming a Linux system and/or Gnu Date you could use something like:
2,963
Posted By apmcd47
If you use my second example you could just add a...
If you use my second example you could just add a second echo thus:
f=$(echo/var/chef/cache/cookbooks/bootstrap_cookbooks_version_*) && [ -f "$f" ] && echo ${f##*_} || echo "file does not exist"
In...
992
Posted By apmcd47
Two stage process not using ls: for f in...
Two stage process not using ls:
for f in status_*.log
do
f1="${%*_}
printf "%s\n" "${f1#.log}"
done
Which can be written as a single line:
for f in status_*.log; do f1="${%*_}; printf...
2,963
Posted By apmcd47
How about one of these two lines: [ -f...
How about one of these two lines:
[ -f /var/chef/cache/cookbooks/bootstrap_cookbooks_version_* ] && echo /var/chef/cache/cookbooks/bootstrap_cookbooks_version_* | sed 's/.*version_//'...
763
Posted By apmcd47
Try adding -g to the declare statement. The...
Try adding -g to the declare statement. The declare statement makes variable local to the function they are created in. The -g switch makes them global.


Use bash's help facility to find out more...
Forum: Programming 11-11-2019
3,753
Posted By apmcd47
realloc() is not guaranteed to reallocate in...
realloc() is not guaranteed to reallocate in situ, which is why you do
str = realloc(str, mem); rather than realloc(str, mem); The next_read variable should be reset with something like next_read =...
780
Posted By apmcd47
mygroup=$(groups $user) printf "User_name:...
mygroup=$(groups $user)
printf "User_name: \"$user\"\nGroup_name: \"%s\"\n" ${mygroup#*:}
You embed the username in the format string in printf. The ${mygroup#*:} strips everything to the left of...
594
Posted By apmcd47
A long time ago I used find ... cpio to create...
A long time ago I used find ... cpio to create tar archives. As it's a long time ago I can't find any examples, but using the GNU CPIO man page and evidence of how I used to copy directories with...
634
Posted By apmcd47
Could it be the space? Try00 03 * * 1-6...
Could it be the space? Try00 03 * * 1-6 /u01/script.sh >"/tmp/myfile_$(date +'%m_%d_%Y').log" 2>&1instead.

If that doesn't work, try puttingexec > "/tmp/myfile_$(date +'%m_%d_%Y').log"
exec 2>&1...
625
Posted By apmcd47
I've found a man page for libPW here...
I've found a man page for libPW here (http://www2.phys.canterbury.ac.nz/dept/docs/manuals/unix/DEC_4.0e_Docs/HTML/MAN/MAN3/1221____.HTM). Its use appears to be deprecated, which is probably why you...
3,258
Posted By apmcd47
Would name referencing be useful? This is...
Would name referencing be useful? This is Corona688's solution using namerefs:
#!/bin/ksh

set -A filelist val1 val2 val3
set -A otherlist q1 q2 q3

verifyfiles() {
nameref Flist=$1
...
2,902
Posted By apmcd47
Okay, then my point about piping into a while...
Okay, then my point about piping into a while statement creating a subshell was wrong - it is true for bash but not for ksh. I'm pretty sure my modifications will work for ksh.

Andrew
2,902
Posted By apmcd47
I was going to say I agree with RudiC, but...
I was going to say I agree with RudiC, but realise $LINE should be a subset of $1, not the other way round, so Rudi's solution probably won't get the results you want. So let's look at what is wrong...
4,414
Posted By apmcd47
GNU Zip will decompress .Z files, sogunzip -c...
GNU Zip will decompress .Z files, sogunzip -c somefile.tar.Z | tar xf -orzcat somefile.tar.Z | tar xf -should work without having to install the compress utility. It may even be possible to use GNU...
563
Posted By apmcd47
What happens if you don't put in all the white...
What happens if you don't put in all the white space?

--data $(printf '{"mName":"%s","oName":"%s"}' "$mname" "$oname")
Or use an intermediate variable:
json_data=$(printf...
563
Posted By apmcd47
--data $(printf '{"mName":"%s","oName":"%s"}'...
--data $(printf '{"mName":"%s","oName":"%s"}' "$mname" "$oname")may work too. Notice how I've used single quotes for the format string to preserve the double quotes without escaping them.

If that...
563
Posted By apmcd47
I've discovered a handy little tool called jq...
I've discovered a handy little tool called jq which can be used to build, display and manipulate JSON. If you are on Linux you can probably install it from the repository. Then you could change your...
1,598
Posted By apmcd47
Please give an example of what your output should...
Please give an example of what your output should look like. Because the file as listed has 0s and 1s on all lines, and therefore grep as you propose to use it will delete all lines,


Andrew
405
Posted By apmcd47
Be more precise with your queries. Check for a...
Be more precise with your queries. Check for a word in what? If I give you a word what do you want to do with it? When you check for today's date, do you mean find the first line with that date and...
405
Posted By apmcd47
Assuming GNU tail you can either list lines from...
Assuming GNU tail you can either list lines from the end (--lines=1234) or from the beginning (--lines=+1234) of the file. Thus listing the full file could be done withtail --lines=+1 myfile
In your...
2,339
Posted By apmcd47
Short of forking bash and modifying alias, I...
Short of forking bash and modifying alias, I don't think there is a way to do what you want. However, this bash function will pollute your environment with lots of aliases. To make things easier I...
Showing results 1 to 25 of 461

 

Featured Tech Videos

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