Tag Info

New answers tagged

1

2 shots: 1. Perhaps login as root is denied (that's the default setting on many systems and it is pretty reasonable). Did you tried with a different user? 2. Did you try sshing with ssh -Y?


0

Try it with awk awk '/parent/,/\/parent/{s=s"\n"$0}/\/modelVersion/{$0=$0s}NR!=FNR' a.xml b.xml or sed with temp-file sed -n '/parent/,/\/parent/w part 1!{ /^.project/,${ /\/modelVersion/r part p } }' a.xml b.xml or with hold-space sed -n '/parent/,/\/parent/H ...


0

This should work. I take some pains to only affect the first occurence of either <parent>...</parent> and </modelVersion> *$ - else it could be made more simple. It also escapes all appended characters correctly just in case. sed -e'/^ *<parent>/!d;:n' \ -e'$d;N;/\n *<.parent>/!bn' \ -e's/[\[:space:]]/\\&/g' ...


0

Figured it out. It does not like the -O grep -rlZ "wrongtext" ~/Library/Calendars | xargs sed -i '' 's/wrongtext/righttext/g'


2

That should do it: grep -rlZ "wrongtext" ~/Library/Calendars | xargs -0 sed -i '' 's/wrongtext/righttext/g' I added the -Z parameter to grep to add a zero byte instead of a newline after every filename. So the command works also with strange filenames. xargs then reads the input delimited by the zero byte with -0 and calls the sed command.


1

Homebrew also has a recipe for rpm installation, just run brew install rpm


0

this will install an app not a shell command ==> Downloading http://www.sybrex.com/download/macgui/files/pdfinfo/PDFInfo.dmg ################################################################## 100.0% ==> Symlinking App 'PDFInfo.app' to '/Users/XYZ/Applications/PDFInfo.app' 🍺 pdfinfo staged at '/opt/homebrew-cask/Caskroom/pdfinfo/latest' (10 ...


0

As others have indicated, your problem isn't that /dev/urandom is missing, but rather how tr works on OS X. Instead of messing around with enviornment varialbes, use perl in place of tr: perl -pe 'tr/A-Za-z0-9_\!\@\#\$\%\^\&\*\(\)-+=//dc;' < /dev/urandom | head -c 32; echo This has the advantage of being portable between OS X, Redhat, and Ubuntu. ...


3

...per your comment on the question... pax -rws'/\.JPG$/.CAP&/' /root/of/copied/tree /dest/path If .jpg and .JPG are your only issues, that should just work. You can also add a print primitive to the filename substitution to get a list of all of those filenames which were changed: pax -rws'/\.JPG$/.CAP&/p' /root/of/copied/tree /dest/path As ...


1

Here's a brief stab: # for f in $( find yoursourcedirectory -name \*.jpg ) ; do cp ${f} yourtargetdirectory/${f}.CAP1.jpg ; done then # for f in $( find yoursourcedirectory -name \*.JPG ) ; do cp ${f} yourtargetdirectory/${f}.CAP2.jpg ; done This will take all the files named *.jpg in the source, and copy them over as *.CAP1.jpg and all of the *.JPG ...


0

One way to do it, assuming you have (1) a grep smart enough to read patterns from stdin, (2) a shell smart enough to handle <(...) constructs, (3) rename from the Unicode::Tussle Perl package, and (4) a collection of files without newlines in their names: cd /path/to/pics ls -1 | tr A-Z a-z | sort | uniq -d | fgrep -ixf - <(ls -1) | \ rename -n ...


-1

Puting this answer here as something you would try if running GNU is impossible to run natively alongside freebsd without using VM box or duel boot. As stated, homebrew cannot install all the GNU coreutils and correct me if I am wrong, but you also want to be able to have all your files at one place(one mechine) If you have a secondary computer connected ...


6

First, this is about a lot more than just coreutils. The BSD equivalent to GNU findutils is also quite different, pretty much every command related to dynamic linkage is different, etc. And then on top of that, you have to deal with versioning differences: OS X still ships a lot of older software to remain on GPL2 instead of GPL3, such as Bash 3.x instead ...


2

Do you mean NDP for IPv6 as defined in RFC 2461? If so, there is ndp command for OSX. To quickly get results you can run: ndp -an


0

Ah - I didn't intend to answer my own, but I just found a good enough solution for me. Since I never need the § key anyway, and I use backticks a fair bit - marking code here for example! - I just used 'Karabiner' (download .dmg from linked page, or brew cask install karabiner) to remap that key. Then simply used my standard .tmux.conf with backtick ...


0

Either you have two problems or one nasty one, to find out which type the command sudo sh -c 'type curl';type curl if both type commands show the same file you have the tough one, but probably you have two simpler ones: curl is installed twice and your dynamic linker is misconfigured.


0

Post output of sw_vers + the exact commands you use for your dd. Also the output of - file aramok - which will fail if aramok is a file or directory (see below). Posting an image is difficult to read. Actual commands are better. It appears you're attempting to somehow write (dd) to a floppy with no formatting. Meaning your trying to dd either a file or a ...


5

The latest version of the HFS+ utilities on Debian are, as far as I can tell, from 2006 and lacking a maintainer. Apple released Time Machine in 2007, and when they did they introduced some quite significant changes to HFS+ (particularly to do with hard links to directories). It is highly likely that the HFS+ tools on Debian cannot deal very well with a Time ...


0

here is a perl one-liner: perl -pe 's/.*?(\d+\.\d+)/$1 . "\n"/eg' file1 > file2


3

As the API returns JSON objects, I'd use a JSON parser for it, combined with sed and grep. I've decided for jq, which is contained in the Ubuntu repo's, so it could be installed using sudo apt-get install jq; I don't know what distro you are using, so you'll have to find that by yourself if you want to use this solution. jq ".[]" <filename> | sed ...


0

tr , \\n <infile | tr -d }{\" | cut -d: -f2 | \ grep -E '^(\+|-)?([0-9]+(\.[0-9]+)?)$' > outfile or tr , \\n <infile | tr -d }{\" | \ grep -E '^[^:]+:(\+|-)?([0-9]+(\.[0-9]+)?)$' | tr : \\n > outfile this assumes that : and , are used to separate keys/values and fields respectively and cannot occur elsewhere.


0

I don't have access to OSX so this is a wild guess... but you can try other techniques to delete files, rather than relying on the shell's globbing to match. Try: find . -not -type d -print -delete or even find . -not -type d -print | perl -nle 'print; unlink'


1

OS X supports pthread_cond_timedwait but it uses absolute calendar time and there is no way to use a monotonically increasing time.


6

don's might be better in most cases, but just in case the file is really big, and you can't get sed to handle a script file that large (which can happen at around 5000+ lines of script), here it is with plain sed: sed -ne:t -e"/\n.*$match/D" \ -e'$!N;//D;/'"$match/{" \ -e"s/\n/&/$A;t" \ -e'$q;bt' -e\} \ ...


1

How about (using GNU grep and bash): $ grep -vFf - file.txt < <(grep -B2 -A1 'fff' file.txt) aaa bbb ccc hhh iii Here we are finding the lines to be discarded by grep -B2 -A1 'fff' file.txt, then using this as an input file to find the desired lines discarding these.


6

You could use grep with -A and -B to print exactly the parts of the file you want to exclude but add the -n switch to also print the line numbers and then format the output and pass it as a command script to sed to delete those lines: grep -n -A1 -B2 PATTERN infile | \ sed -n 's/^\([0-9]\{1,\}\).*/\1d/p' | \ sed -f - infile Another way with comm: comm ...


4

If you don't mind using vim: $ export PAT=fff A=1 B=2 $ vim -Nes "+g/${PAT}/.-${B},.+${A}d" '+w !tee' '+q!' foo aaa bbb ccc hhh iii -Nes turns on non-compatible, silent ex mode. Useful for scripting. +{command} tell vim to run {command} on the file. g/${PAT}/ - on all lines matching /fff/. This gets tricky if the pattern contains regular expression ...


1

diskutil list will show you the Drives. A Partition is /dev/diskXsY. So dd if=/dev/diskXsY of=/BACKUPIMAGE.img with the appropriate X and Y should do it for you.


1

Too fast diagnosis I read online that this might be resolved by repairing permission on the drive. Unfortunatly, from the description of your problem, this is wrong. What need to be repaired is the filesystem on your external disk SEAGATE. Analysis of lsof The output of your lsof command tells that the command mds (1st column) is actually reading ...


0

It appears that Spotlight is indexing this drive. There could be a problem that is causing Spotlight to hang up and constantly pound this drive. The mds process is the metadata server. Try killing this process and then tell spotlight to not index this drive. To disable spotlight indexing go to System Preferences -> Spotlight -> Privacy and add the disk to ...


1

FileVault (and OS X in general) does not check /etc/passwd, so a script using it as a trigger will not work. FileVault uses DirectoryServices, so any interception of what is being entered has to be through Apple's OpenDirectory implementation (see documentation on DirectoryService). How to do that is beyond me, but reading up on ...


0

You could also save a new file that overwrites .bash_profile. Sublime Text allowed saving a file with a . in front of the name (albeit, with a few warnings).



Top 50 recent answers are included