hello all,

I work at a newspaper, and we use QuarkXPress for Desktop publishing...and we have a pretty unfortunate glitch, when Quark crashes, it seems to untick the backup option in the pref's...

so I was thinking this would be a good place for a small recursive script, that would run in the background, and copy all open quark documents, to a users ~/Desktop/Backups/ dir. then wait 7-10mins, and run again...I have a good idea where im going with most of it, but i have (what i think) is a small hangup. where I'm going so far is:

lsof |grep QuarkXP|awk '{ print $9,$10,$11,$12 ]'>/tmp/output1

This gives me all of the Quark open files, but leaves the first line with a /
so I used:

sed '1d' /tmp/output1>output2

that line removes that 1st / for me, then im left with a huge list of files.
Id like to be able to:

cp `cat /tmp/output2` ~/Desktop/Backups

but the problem is, some of the paths have spaces in them, that cannot be removed, so i would need to append a \ infront of them to make it work...and that's where im stuck, i rtfm for sed, and some of awk, and being trying the google for a grep solution, but no bones either way.

any help would greatly appreciated, thanks.

...As I wrote this, i might've had a lightbulb. couldn't i use sed to append every line in the beginning and end with a " that way it includes the spaces?

I tried using sed to prepend, and append the file list with quotes, still no dice.

> lsof |grep QuarkXP|awk '{ print $9,$10,$11,$12 ]'>/tmp/output1
1. Copy the line you used, not something typed "as you remember it". The ] breaks it. I'm not sure your awk command to print a few fields is going to work, since the default field separator is whitespace, the result isn't going to be a meaningful filename.

Post an example output of lsof |grep QuarkXP

heres the output2, which is the lsof,grep,awk:

/Applications/QuarkXPress 6.1/QuarkXPress/Contents/MacOS/QuarkXPress
/Applications/QuarkXPress 6.1/OmniCore.Mach-O.r.dylib
/Library/Frameworks/Xerces-c-cw8.framework/Versions/2.1/Xerces-c-cw8
/System/Library/CoreServices/CharacterSets/CFUnicodeData-B.mapping
/System/Library/CoreServices/CharacterSets/CFCharacterSetBitmaps.bitmap
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/HIToolbox.rsrc
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/English.lproj/Localized.rsrc
/Library/Caches/com.apple.IntlDataCache.sbdl.1813433788
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/QD.framework/Versions/A/Resources/QD.rsrc
/Library/Caches/com.apple.ATS/1813433788/annex_aux
/System/Library/Filesystems/URLMount/afp.URLMounter/Contents/MacOS/afp
/System/Library/Frameworks/QuickTime.framework/Versions/A/Resources/QuickTime.rsrc
/System/Library/Frameworks/QuickTime.framework/Versions/A/Resources/English.lproj/Localized.rsrc
/System/Library/Fonts/Geneva.dfont
/System/Library/CoreServices/CharacterSets/CFUniCharPropertyDatabase.data
/System/Library/Fonts/LucidaGrande.dfont
/Applications/QuarkXPress 6.1/XTension/Quark CMS.xnt/Contents/MacOS/KodakCarbonShared.cfm/Contents/MacOS/KodakCarbonShared
/Applications/QuarkXPress 6.1/Required Components/Cool Blends.qrc/Contents/MacOS/Cool
/System/Library/QuickTime/AppleProResDecoder.component/Contents/MacOS/AppleProResDecoder
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/Extras.rsrc
/Library/QuickTime/Perian.component/Contents/MacOS/Perian
/System/Library/QuickTime/ApplePixletVideo.component/Contents/MacOS/ApplePixletVideo
/System/Library/Caches/com.apple.IntlDataCache.kbdx
/Library/Printers/PPD Plugins/AdobePDFPDE700.plugin/Contents/MacOS/AdobePDFPDE700
/Library/Printers/hp/PDEs/hpColorOptions.plugin/Contents/MacOS/hpColorOptions
/Applications/QuarkXPress 6.1/Required Components/GIF Filter.qrc/Contents/MacOS/GIF
/Applications/QuarkXPress 6.1/Required Components/HyperLinks.qrc/Contents/MacOS/HyperLinks
/Applications/QuarkXPress 6.1/Required Components/Layers.qrc/Contents/MacOS/Layers
/Applications/QuarkXPress 6.1/Required Components/Placeholders.qrc/Contents/MacOS/Placeholders
/Applications/QuarkXPress 6.1/Required Components/HTML Export.qrc/Contents/MacOS/HTML
/Applications/QuarkXPress 6.1/Required Components/JPEG Filter.qrc/Contents/MacOS/JPEG
/Applications/QuarkXPress 6.1/Required Components/SpellChecker.qrc/Contents/MacOS/SpellChecker
/Applications/QuarkXPress 6.1/Required Components/Tables.qrc/Contents/MacOS/Tables
/Applications/QuarkXPress 6.1/Required Components/Web Tools.qrc/Contents/MacOS/Web
/Applications/QuarkXPress 6.1/XTension/avenue.quark.xnt/Contents/MacOS/avenue.quark
/Applications/QuarkXPress 6.1/XTension/Dejavu.xnt/Contents/MacOS/Dejavu
/Applications/QuarkXPress 6.1/XTension/CompressedImage Import.xnt/Contents/MacOS/CompressedImage Import
/Applications/QuarkXPress 6.1/XTension/FontDownloadingXT.xnt/Contents/MacOS/FontDownloadingXT
/Applications/QuarkXPress 6.1/XTension/ClassFlow 2.5.3.xnt/Contents/MacOS/ClassFlow
/Applications/QuarkXPress 6.1/XTension/Custom Bleeds.xnt/Contents/MacOS/Custom Bleeds
/Applications/QuarkXPress 6.1/XTension/Guide Manager.xnt/Contents/MacOS/Guide Manager
/Applications/QuarkXPress 6.1/XTension/DragX.xnt/Contents/MacOS/DragX
/Applications/QuarkXPress 6.1/XTension/EditOriginal.xnt/Contents/MacOS/EditOriginal
/Applications/QuarkXPress 6.1/XTension/ImageMap.xnt/Contents/MacOS/ImageMap
/Applications/QuarkXPress 6.1/XTension/FontRetrieveXT.xnt/Contents/MacOS/FontRetrieveXT
/Applications/QuarkXPress 6.1/XTension/Index.xnt/Contents/MacOS/Index
/Applications/QuarkXPress 6.1/XTension/HTML Text Import.xnt/Contents/MacOS/HTML
/Applications/QuarkXPress 6.1/XTension/Kern-Track Editor.xnt/Contents/MacOS/Kern-Track Editor
/Applications/QuarkXPress 6.1/XTension/OPI.xnt/Contents/MacOS/OPI
/Applications/QuarkXPress 6.1/XTension/PDF Filter.xnt/Contents/MacOS/PDF Filter
/Applications/QuarkXPress 6.1/XTension/Item Sequence.xnt/Contents/MacOS/Item Sequence
/Applications/QuarkXPress 6.1/XTension/Jabberwocky.xnt/Contents/MacOS/Jabberwocky
/Applications/QuarkXPress 6.1/XTension/PNG Filter.xnt/Contents/MacOS/PNG Filter
/Applications/QuarkXPress 6.1/XTension/MS-Word 6-2000 Filter.xnt/Contents/MacOS/MS-Word
/Applications/QuarkXPress 6.1/XTension/QTools.xnt/Contents/MacOS/QTools
/Applications/QuarkXPress 6.1/XTension/Quark CMS.xnt/Contents/MacOS/Quark CMS
/Applications/QuarkXPress 6.1/XTension/RTF Filter.xnt/Contents/MacOS/RTF Filter
/Applications/QuarkXPress 6.1/XTension/Scissors.xnt/Contents/MacOS/Scissors
/Applications/QuarkXPress 6.1/XTension/Script.xnt/Contents/MacOS/Script
/Applications/QuarkXPress 6.1/XTension/Shape of Things.xnt/Contents/MacOS/Shape
/Applications/QuarkXPress 6.1/XTension/Suitcase XT6 (US).xnt/Contents/MacOS/Suitcase
/Applications/QuarkXPress 6.1/XTension/Super Step and
/Applications/QuarkXPress 6.1/XTension/Table Import.xnt/Contents/MacOS/Table Import
/Applications/QuarkXPress 6.1/XTension/Type Tricks.xnt/Contents/MacOS/Type Tricks
/Applications/QuarkXPress 6.1/XTension/Vista.xnt/Contents/MacOS/Vista
/Applications/QuarkXPress 6.1/XTension/WordPerfect Filter.xnt/Contents/MacOS/WordPerfect Filter
/Applications/QuarkXPress 6.1/XTension/XML Import.xnt/Contents/MacOS/XML Import
/Applications/QuarkXPress 6.1/XTension/XPress Tags Filter.xnt/Contents/MacOS/XPress
/Applications/QuarkXPress 6.1/XTension/XSLT Export.xnt/Contents/MacOS/XSLT Export
/usr/share/icu/icudt32b.dat
/System/Library/CFMSupport/CarbonLib
/Applications/QuarkXPress 6.1/XTension/Quark CMS.xnt/Contents/MacOS/KodakCarbonShared.cfm/Contents/MacOS/KodakCMSC
/Applications/QuarkXPress 6.1/XTension/MS-Word 6-2000 Filter.xnt/Contents/MacOS/OLE.CARBON.Shared.cfm/Contents/MacOS/OLE.CARBON.Shared
/System/Library/Components/AppleScript.component/Contents/MacOS/AppleScript
/System/Library/Caches/com.apple.IntlDataCache.tecx
/Library/Printers/hp/PDEs/hpEdgeToEdge.plugin/Contents/MacOS/hpEdgeToEdge
/Applications/QuarkXPress 6.1/XTension/QuarkTT.dylib
/Applications/QuarkXPress 6.1/XTension/QuarkPDF.dylib
/Applications/QuarkXPress 6.1/XTension/Table Import.xnt/Contents/MacOS/OLE.CARBON.Shared.cfm/Contents/MacOS/OLE.CARBON.Shared
/Applications/QuarkXPress 6.1/XTension/Quark Image Engine.dylib
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Print.framework/Versions/A/Plugins/PrintCocoaUI.bundle/Contents/MacOS/PrintCocoaUI
/Library/Printers/hp/Frameworks/hpImaging.framework/Versions/C/hpImaging
/Library/Caches/com.apple.LaunchServices-0141813433788.csstore
/Library/Printers/hp/PDEs/hpImageQuality.plugin/Contents/MacOS/hpImageQuality
/Library/Printers/hp/PDEs/hpFinishing.plugin/Contents/MacOS/hpFinishing
/Library/Printers/hp/PDEs/hpProofAndPrint.plugin/Contents/MacOS/hpProofAndPrint
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Print.framework/Versions/A/Plugins/PrintingCocoaPDEs.bundle/Contents/MacOS/PrintingCocoaPDEs
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Print.framework/Versions/A/Plugins/PrintingTiogaPDEs.bundle/Contents/MacOS/PrintingTiogaPDEs
/System/Library/Printers/CVs/Converter.plugin/Contents/MacOS/Converter
/System/Library/Fonts/Helvetica.dfont
/System/Library/Printers/Libraries/libPPDLib.dylib
/System/Library/Printers/Libraries/libLW8Utils.dylib
/System/Library/Printers/Libraries/libLW8Converter.dylib
/usr/lib/dyld
/usr/lib/libSystem.B.dylib
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreText.framework/Versions/A/CoreText
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/ATS
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
/usr/lib/libicucore.A.dylib
/usr/lib/libobjc.A.dylib
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CFNetwork.framework/Versions/A/CFNetwork
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata
/System/Library/Frameworks/Security.framework/Versions/A/Security
/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ColorSync.framework/Versions/A/ColorSync
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/PrintCore
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/QD.framework/Versions/A/QD
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libJP2.dylib
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
/System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Print.framework/Versions/A/Print
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/CarbonSound.framework/Versions/A/CarbonSound
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
/System/Library/Frameworks/CoreData.framework/Versions/A/CoreData
/System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore
/System/Library/Frameworks/QuickTime.framework/Versions/A/QuickTime
/usr/lib/libstdc++.6.0.4.dylib
/System/Library/Frameworks/AddressBook.framework/Versions/A/AddressBook
/System/Library/PrivateFrameworks/DSObjCWrappers.framework/Versions/A/DSObjCWrappers
/System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos
/System/Library/Frameworks/AppleShareClientCore.framework/Versions/A/AppleShareClientCore
/System/Library/QuickTime/QuickTimeComponents.component/Contents/MacOS/QuickTimeComponents
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/libCFilter.A.dylib
/System/Library/Printers/Libraries/libConverter.dylib
/dev/null
/dev/console
/dev/console
op=0x384768
op=0x384768
/Applications/QuarkXPress 6.1/QuarkXPress/Contents/Resources/QuarkXPress.rsrc
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/HIToolbox.rsrc
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/English.lproj/Localized.rsrc
/Users/william.muldoon/Library/Preferences/Quark/QuarkXPress 6.0/XPress Preferences.prf/..namedfork/rsrc
op=0x384768
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/Extras.rsrc
/System/Library/Frameworks/QuickTime.framework/Versions/A/Resources/QuickTime.rsrc
/System/Library/Frameworks/QuickTime.framework/Versions/A/Resources/English.lproj/Localized.rsrc
/private/var/tmp/folders.1813433788/TemporaryItems/QuarkXPress Temp
/private/var/tmp/folders.1813433788/TemporaryItems/QuarkXPress Temp/..namedfork/rsrc
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/QD.framework/Versions/A/Resources/QD.rsrc
/Applications/QuarkXPress 6.1/Required Components/Cool Blends.qrc/Contents/Resources/Cool
/Applications/QuarkXPress 6.1/Required Components/GIF Filter.qrc/Contents/Resources/GIF
/Applications/QuarkXPress 6.1/Required Components/HyperLinks.qrc/Contents/Resources/HyperLinks.rsrc
/Applications/QuarkXPress 6.1/Required Components/Layers.qrc/Contents/Resources/Layers.rsrc
/Applications/QuarkXPress 6.1/Required Components/Placeholders.qrc/Contents/Resources/Placeholders.rsrc
/Applications/QuarkXPress 6.1/Required Components/HTML Export.qrc/Contents/Resources/HTML
/Applications/QuarkXPress 6.1/Required Components/JPEG Filter.qrc/Contents/Resources/JPEG
/Applications/QuarkXPress 6.1/Required Components/SpellChecker.qrc/Contents/Resources/SpellChecker.rsrc
/Applications/QuarkXPress 6.1/Required Components/Tables.qrc/Contents/Resources/Tables.rsrc
/Applications/QuarkXPress 6.1/Required Components/Web Tools.qrc/Contents/Resources/Web
/Applications/QuarkXPress 6.1/XTension/avenue.quark.xnt/Contents/Resources/avenue.quark.rsrc
/Applications/QuarkXPress 6.1/XTension/Dejavu.xnt/Contents/Resources/Dejavu.rsrc
/Applications/QuarkXPress 6.1/XTension/CompressedImage Import.xnt/Contents/Resources/CompressedImage Import.rsrc
/Applications/QuarkXPress 6.1/XTension/FontDownloadingXT.xnt/Contents/Resources/FontDownloadingXT.rsrc
/Applications/QuarkXPress 6.1/XTension/ClassFlow 2.5.3.xnt/Contents/Resources/ClassFlow.rsrc
/Applications/QuarkXPress 6.1/XTension/Custom Bleeds.xnt/Contents/Resources/Custom Bleeds.rsrc
/Applications/QuarkXPress 6.1/XTension/Guide Manager.xnt/Contents/Resources/Guide Manager.rsrc
/Applications/QuarkXPress 6.1/XTension/DragX.xnt/Contents/Resources/DragX.rsrc
/Applications/QuarkXPress 6.1/XTension/EditOriginal.xnt/Contents/Resources/EditOriginal.rsrc
/Applications/QuarkXPress 6.1/XTension/ImageMap.xnt/Contents/Resources/ImageMap.rsrc
/Applications/QuarkXPress 6.1/XTension/FontRetrieveXT.xnt/Contents/Resources/FontRetrieveXT.rsrc
/Applications/QuarkXPress 6.1/XTension/Index.xnt/Contents/Resources/Index.rsrc
/Applications/QuarkXPress 6.1/XTension/HTML Text Import.xnt/Contents/Resources/HTML
/Applications/QuarkXPress 6.1/XTension/Kern-Track Editor.xnt/Contents/Resources/Kern-Track Editor.rsrc
/Applications/QuarkXPress 6.1/XTension/OPI.xnt/Contents/Resources/OPI.rsrc
/Applications/QuarkXPress 6.1/XTension/PDF Filter.xnt/Contents/Resources/PDF Filter.rsrc
/Applications/QuarkXPress 6.1/XTension/Item Sequence.xnt/Contents/Resources/Item Sequence.rsrc
/Applications/QuarkXPress 6.1/XTension/Jabberwocky.xnt/Contents/Resources/Jabberwocky.rsrc
/Applications/QuarkXPress 6.1/XTension/PNG Filter.xnt/Contents/Resources/PNG Filter.rsrc
/Applications/QuarkXPress 6.1/XTension/MS-Word 6-2000 Filter.xnt/Contents/Resources/MS-Word
/Applications/QuarkXPress 6.1/XTension/QTools.xnt/Contents/Resources/QTools.rsrc
/Applications/QuarkXPress 6.1/XTension/Quark CMS.xnt/Contents/Resources/Quark CMS.rsrc
/Applications/QuarkXPress 6.1/XTension/RTF Filter.xnt/Contents/Resources/RTF Filter.rsrc
/Applications/QuarkXPress 6.1/XTension/Scissors.xnt/Contents/Resources/Scissors.rsrc
/Applications/QuarkXPress 6.1/XTension/Script.xnt/Contents/Resources/Script.rsrc
/Applications/QuarkXPress 6.1/XTension/Shape of Things.xnt/Contents/Resources/Shape
/Applications/QuarkXPress 6.1/XTension/Suitcase XT6 (US).xnt/Contents/Resources/Suitcase
/Applications/QuarkXPress 6.1/XTension/Super Step and
/Applications/QuarkXPress 6.1/XTension/Table Import.xnt/Contents/Resources/Table Import.rsrc
/Applications/QuarkXPress 6.1/XTension/Type Tricks.xnt/Contents/Resources/Type Tricks.rsrc
/Applications/QuarkXPress 6.1/XTension/Vista.xnt/Contents/Resources/Vista.rsrc
/Applications/QuarkXPress 6.1/XTension/WordPerfect Filter.xnt/Contents/Resources/WordPerfect Filter.rsrc
/Applications/QuarkXPress 6.1/XTension/XML Import.xnt/Contents/Resources/XML Import.rsrc
/Applications/QuarkXPress 6.1/XTension/XPress Tags Filter.xnt/Contents/Resources/XPress
/Applications/QuarkXPress 6.1/XTension/XSLT Export.xnt/Contents/Resources/XSLT Export.rsrc
/Users/william.muldoon/Library/Preferences/Quark/QuarkXPress 6.0/Layers.prf/..namedfork/rsrc
/Users/william.muldoon/Library/Preferences/Quark/QuarkXPress 6.0/Hyperlinks.prf/..namedfork/rsrc
/Users/william.muldoon/Library/Preferences/Quark/QuarkXPress 6.0/Tables.prf/..namedfork/rsrc
/Users/william.muldoon/Library/Preferences/Quark/QuarkXPress 6.0/WebTool.prf/..namedfork/rsrc
/Applications/QuarkXPress 6.1/XTension/Quark CMS.xnt/Contents/MacOS/KodakCarbonShared.cfm/Contents/MacOS/KodakCMSC/..namedfork/rsrc
/Users/william.muldoon/Library/Preferences/Quark/QuarkXPress 6.0/Quark CMS.prf/..namedfork/rsrc
/Users/william.muldoon/Library/Preferences/Quark/QuarkXPress 6.0/avenue.quark.prf/..namedfork/rsrc
/Users/william.muldoon/Library/Preferences/Quark/QuarkXPress 6.0/Dejavu.prf/..namedfork/rsrc
/Users/william.muldoon/Library/Preferences/Quark/QuarkXPress 6.0/Index.prf/..namedfork/rsrc
/Users/william.muldoon/Library/Preferences/Quark/QuarkXPress 6.0/jabber.prf/..namedfork/rsrc
/Users/william.muldoon/Library/Preferences/Quark/QuarkXPress 6.0/ShapeofThings.prf/..namedfork/rsrc
/Users/william.muldoon/Library/Preferences/Quark/QuarkXPress 6.0/Type Tricks.prf/..namedfork/rsrc
/Users/william.muldoon/Library/Preferences/Quark/QuarkXPress 6.0/XML Import.prf/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/DIC/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/FOCOLTONE/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/PANTONE(R) hexachrome coated/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/PANTONE(R) hexachromeuncoated/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/PANTONE(R) metallic coated/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/PANTONE(R) pastel coated/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/PANTONE(R) pastel uncoated/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/PANTONE(R) process coated/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/PANTONE(R) process uncoated/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/PANTONE(R) processcoated EURO/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/PANTONE(R) solid coated/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/PANTONE(R) solid matte/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/PANTONE(R) solid to
/Applications/QuarkXPress 6.1/Color/PANTONE(R) solid uncoated/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/PANTONE(R) solidinhexachrome/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/PANTONE(R) soltoproc co
/Applications/QuarkXPress 6.1/Color/TOYO/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/TRUMATCH/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/WEB NAMED/..namedfork/rsrc
/Applications/QuarkXPress 6.1/Color/WEB SAFE/..namedfork/rsrc
/Users/william.muldoon/Documents/NEP Backups/A5 12-02-08 new


The last entry is the one im looking to backup, but sometimes, we have more than one file open, different kinds of files that aren't going to be in the NEP backups dir, etc.

I'm confused.
Not all those lines contain "QuarkXP", but apparently, you passed the output of lsof through grep.

Hey there,

You could also just slap it all together on one line and forget about the output file. Try this and let me know if I fat-fingered any of it - this should all be one line if it gets split up:

lsof |grep QuarkXP|awk '{ print $9,$10,$11,$12 ]'|sed 1d|xargs -ivar cp "var" ~/Desktop/Backups/.

depending on your version of xargs, the -i argument may be -I.

Hope that helps you out :)

Best wishes,

Mike

Comments
Let's make it count

Mike,

Thanks for the quick response...
it looks like most of it works. its copying a majority of files, but not the one i need...yet. I run mac os x 10.4 and i needed to -I, it looks like it never finishes copying...it doesnt get all the files from the lsof, and i need to ctrl C it. i was wondering about the -Ivar, is there supposed to be a space inbetween them? if not, could you point me to a place to read up on this, I'd rather learn it on my own then just be handed a script.

either way, thanks a ton.

The following may be closer to what you want:

lsof | grep QuarkXP  \
      | cut -c76- \
      | sort | uniq \
      | awk '{ printf("\"%s\"\n", $0)}' > /tmp/output1

The cut(1) deletes everything but the filename. Awk then prints the quoted filenames to the output file. To make your life even easier, you could:

while :; do
  lsof | grep QuarkXP  \
       | cut -c76- \
       | sort | uniq \
       | awk 'begin {getline} {printf("mkdir -p \"~/Desktop/Backups/`dirname '%s'`\"\ncp \"%s\" ~/Desktop/Backups/%s\n", $0, $0, $0)}' > ~/Desktop/Backup-QuarkXP
  sh ~/Desktop/Backups-QuarkXP
  sleep 600
done

Here, cut() does the same thing. Awk now tosses the first line, and prints the rest of the filenames as cp() commands, dumping the output to a file on your desktop, which is subsequently executed. The relative pathnames should be preserved. It then sleeps 10 minutes and runs again.

The |sort|uniq bit should eliminate duplicates.

Neither script is guaranteed to run straight off; you may need to handle quote nesting and some other infuriatingly obtuse stuff. :)

Hey there,

Some excellent suggestions from Fest3er, as well :)

For your version, you may need to include a space. My (non-Gnu) version likes me not to include a space, but I've used Gnu xargs that preferred it.

Basically, the "-I var" is setting up your, normally, implicit space (xargs processes input a line at a time) and gives it a variable name (doesn't have to be var, I just chose that because it seemed appropriate at the time). This way you can easily enclose your reference to var in quotes ("var") . Otherwise, you're line would look like this, and you'd still have problems with the spaces, if it would work at all:

xargs cp ~/Desktop/Backups/.

and xargs would assume your implicit input from the pipe should be placed at the end of the expression, which would be bad.

Of course, I'm not an xargs expert :) I found this on the web for you, geared more toward Mac OSX, that might be helpful (it's the basic manual page for OS X, but has some good links off of it, as well):

http://developer.apple.com/DOCUMENTATION/DARWIN/Reference/ManPages/man1/xargs.1.html

Best wishes and good luck to you!

, Mike

sorry, it took a while to get back to everyone, i've been busy and back burnered this one,

what i finally ended up with (which worked!) is

#!/bin/bash
lsof |grep NEP|awk '{ print $9,$10,$11,$12,$13,$14,$15,$16,$17,$18 }'>~/Desktop/output
while read file; do cp -f "$file" ~/Desktop/Backup/;done <~/Desktop/output
sleep 360
exec ~/Desktop/backup.sh
exit

the grep for NEP, is because our backup dir is named "NEP Backups", so this one finds all documents that get backed up to there, I tried going the lsof |grep QuarkXP way, but it had too many files for me to sift through, I surfed the net for a while to come up with the idea of the "while read" part, and didn't have to mess with using sed to remove the first line of output.

I'm going to mark this thread as solved, thanks a bunch!

Comments
Nicely done!
Thanks, and well done!
This question has already been answered. Start a new discussion instead.