Search Results

Search: Posts Made By: apmcd47
59,290
Posted By apmcd47
Try appending this to your command: 2>...
Try appending this to your command:


2> >(grep -v 'No such file or directory' >&2)
It should remove the above message from the STDERR but allow other messages to be printed.


Works for bash...
6,396
Posted By apmcd47
That is close - try this while read product id...
That is close - try this
while read product id features
do
printf "${product}, %s\n" ${features%#*}
done < Check_FileYour example was using only two variables (f1, f3) to read the fields...
10,752
Posted By apmcd47
So basically you want to confirm that /home is on...
So basically you want to confirm that /home is on the /mnt/linux_data partition rather than /? You could check out the stat command:
stat -c%d "${HOME}"
This will give the device number of the...
10,234
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
10,234
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
5,209
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
5,209
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...
2,921
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:
9,024
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...
2,998
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...
9,024
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_//'...
3,614
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
20,634
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 =...
2,462
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...
3,509
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...
2,155
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...
1,848
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...
10,958
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
...
7,137
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
7,137
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...
12,734
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...
11,243
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...
11,243
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...
11,243
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...
3,315
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
Showing results 1 to 25 of 464

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