devexpress asp.net pdf viewer : Cut pages out of pdf online control software platform web page windows .net web browser AppleShellScripting-201416-part646

Besuretodocumentthisnonstandarddependencyappropriatelyinyourscript,alongwithanexplanationof
howtoinstallthemodule.
sed
Differentversionsof
sed
usedifferentflagsforenablingextendedregularexpressions.GNU
sed
(commonly
usedinLinux)usesthe
-r
flag.BSDversionsof
sed
(includingtheOSXversion)usethe
-E
flag.Ifyourscript
mustrunonbothplatforms,youmusttestforcompatibilityfirst.Forexample:
STRING="$(echo 'xy' | sed -E 's/(x)y/\1/' 2> /dev/null)"
if [ "$STRING" = "x" ] ; then
SEDERE="-E"
else
SEDERE="-r"
fi
...
sed $SEDERE ...
Inaddition,mostGNUversionsof
sed
generatewarningsforunusedlabels.Mostotherimplementationsdo
not.
Also,whenthe
y
functionisspecified(forexample,
sed y/string1/string2/
),mostGNUversionsconvert
doublebackslashestosinglebackslashes.Thisbehaviorisnotportable,soyoushouldnotdependonit.
Becauseofthisincompatibility,ifyouneedtoconstructanexpressioncontaininguser-enteredstringsthat
couldpotentiallyincludeabackslash,youshouldavoidtheproblementirelybyusingthe
s
function(for
example,
sed s/string1/string2/
)insteadofthe
y
function.
sort
Theform
sort +POS1 -POS2 ...
isasyntaxspecifictotheGNUversionof
sort
andisconsideredobsolete.
ThissyntaxisnotportableandisnotsupportedinOSXbeginninginversion10.5.
Forexample:
$ cat data
b
a
a
b
DesigningScriptsforCross-PlatformDeployment
GeneralCommand-LineToolDifferences
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
161
Cut pages out of pdf online - control software platform:C# PDF Page Extract Library: copy, paste, cut PDF pages in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Easy to Use C# Code to Extract PDF Pages, Copy Pages from One PDF File and Paste into Others
www.rasteredge.com
Cut pages out of pdf online - control software platform:VB.NET PDF Page Extract Library: copy, paste, cut PDF pages in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Detailed VB.NET Guide for Extracting Pages from Microsoft PDF Doc
www.rasteredge.com
$ sort data
a
b
b
a
$ sort +1 -2 data
sort: invalid option -- 2
Try `sort --help' for more information.
Instead,youshouldusethe
-k
flagtodothesamething.Forexample:
$ sort -k 2,3 data
b
a
a
b
Note:  Thefieldandcharacterpositionsarenumbereddifferentlywiththissyntax.Numberingfor
the
-k
syntaxstartsatone(
1
),whiletheobsoleteplusandminussyntaxstartsatzero(
0
).
Compatibility Note:  OSXv10.5andlaterdoesnotsupportthislegacyGNUsortsyntax.However,
asatemporaryworkaroundwhileyourewritetheoffendingscripts,youcansetthe
_POSIX2_VERSION
environmentvariableasshowinthefollowingsnippet:
export _POSIX2_VERSION=200111
# or in CSH
setenv _POSIX2_VERSION 200111
Donotrelyonthisworkaroundforproductioncode;itscontinuedsupportisnotguaranteed.
Formoreinformationoncompatibilityissueswiththe
sort
command,seethemanualpagefor
sort
.
stty
PriortoOSXv10.5,the
stty
commanddidnotsupportthefollowingcontrolmodes:
bs0
and
bs1
cr0
,
cr1
,
cr2
,and
cr3
DesigningScriptsforCross-PlatformDeployment
GeneralCommand-LineToolDifferences
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
162
control software platform:C# HTML5 PDF Viewer SDK to view PDF document online in C#.NET
Image: Copy, Paste, Cut Image in Page. Link: Edit URL. Bookmark can view PDF document in single page or continue pages. Support to zoom in and zoom out PDF page.
www.rasteredge.com
control software platform:VB.NET PDF- View PDF Online with VB.NET HTML5 PDF Viewer
Remove Image from PDF Page. Image: Copy, Paste, Cut Image in can view PDF document in single page or continue pages. Support to zoom in and zoom out PDF page.
www.rasteredge.com
ff0
and
ff1
nl0
and
nl1
tab0
,
tab1
,
tab2
,and
tab3
vt0
and
vt1
Inaddition,priortoOSXv10.5,
stty
didnotsupportthefollowingoptions:
ocrnl
and
-ocrnl
ofdel
and
-ofdel
ofill
and
-ofill
onlret
and
-onlret
onocr
and
-onocr
Inlegacymode,thesemodesandoptionsarestillnotaccepted.Formoreinformation,seethemanualpage
for
stty
.
tail
The
tail
commanddifferssignificantlybetweenLinuxandOSX.TheGNUvariantof
tail
providesoptions
thattheOSXversiondoesnotandviceversa.BothprovidefeaturesthatarenotpartofthePOSIXspecification,
andthusmaynotbeportable.
AccordingtothePOSIXspecification,thefollowingflagsareportable:
-f
(continuetowaitforthefiletogrow
orfortheFIFOtoprovideadditionaldata),
-c
(bytecount),and
-n
(linecount).
Further,POSIXonlyexplicitlyrequiresthe
tail
commandtoacceptasinglefilenameasanargument.Any
usewithmultiplefilesisinherentlynotportable.
-b
(OSX)
OSXprovidesa
-b
flagthatallowsyoutospecifyalocationin512-byteblockincrements.Formaximum
portability,multiplythenumberby512yourselfandusethe
-c
flaginstead.
-F
(OSXandLinux)
BothLinuxandOSXprovidea
-F
flagthatisequivalentto
-f --retry
.Thisiseasilyavoidedwiththe
workaroundsdescribedaspartoftheentriesfortheindividual
--follow
and
--retry
flags.
DesigningScriptsforCross-PlatformDeployment
GeneralCommand-LineToolDifferences
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
163
control software platform:VB.NET Image: Image Cropping SDK to Cut Out Image, Picture and
and easy to use .NET solution for developers to crop / cut out image file This online tutorial page will illustrate the image cropping function from following
www.rasteredge.com
control software platform:VB.NET PDF Text Extract Library: extract text content from PDF
Extract highlighted text out of PDF document. Best VB.NET PDF text extraction SDK library and component for Online Visual Basic .NET class source code for quick
www.rasteredge.com
--follow
(Linux)
Linuxalsoprovidesa
--follow
flag,whichisequivalentto
-f
exceptwhenusedwithfiledescriptors.
Whenworkingwithfiles,use
-f
instead.
ThefiledescriptorsyntaxisnotportableandisnotsupportedexceptinLinux.Useanamedpipe(FIFO)
instead.
--max-unchanged-stat
(Linux)
Linuxprovidesa
--max-unchanged-stat
thattriesreopeningafileifyouareusingthe
-f
flagand
thefilehasn’tchangedinawhile.Thisallowsittohandlethecaseherethefileisrenamedandanew
filewiththesamenameiscreatedasoftenhappenswithlogfiles.Thereisnoeasyportablereplacement
forthisfeature.
--pid
(Linux)
Linuxprovidesa
--pid
flagthatterminatesthe
tail
commandafterthespecifiedprocessIDdies.
Thereisnoeasyportablereplacementforthisfeature,thoughitcouldbereplacedinanot-so-portable
fashionbyascriptrunningasabackgroundjobthatusesthe
ps
commandtoverifytheexistenceofthe
process.
Assumingtheprocessbeingwatchedwasoriginallystartedbytheshellscriptinthebackground,itcould
alsobereplacedbyrunningthe
tail
commandinthebackgroundandusingthe
wait
shellbuiltinto
waitfortheprocessIDtoexit,thenkillingthe
tail
command.Formoreinformation,seeBackground
JobsandJobControl (page 197).
-q
(Linux)
Aswiththe
head
command,Linuxprovides
-v
and
-q
flags.Seehead (page 156)earlierinthissection
forexplanationoftheseflagsandsuggestedalternatives.
-r
(OSX)
OSXprovidesa
-r
flagthatreversestheorderofthelinesprinted.Italsochangesthebehaviorofthe
leadingplus(
+
)andminus(
-
)symbolswhenpassedaspartofargumentstothe
-b
,
-c
,and
-n
flags.
ItispossibletowriteanAWKscripttoemulatethisbehaviorbypushingeachlineintheinputfileinto
anarray,thenprintingthelinesinreverseorderandeitherskippingagivennumberofentriesinthe
arraytoskiplinesorusing
substr
calltoskipagivennumberofbytes.Thehead (page 156)sectionof
thischapterprovidesanexampleofhowtoemulate
head -c
usinganAWKscript;thisexampleprovides
agoodstartingpointforwritingascriptthatemulatesthis
tail
feature.
DesigningScriptsforCross-PlatformDeployment
GeneralCommand-LineToolDifferences
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
164
control software platform:C# PDF Text Extract Library: extract text content from PDF file in
Free online source code for extracting text from adobe Ability to extract highlighted text out of PDF C# example code for text extraction from all PDF pages.
www.rasteredge.com
control software platform:VB.NET PDF - View PDF with WPF PDF Viewer for VB.NET
Image from PDF Page. Image: Copy, Paste, Cut Image in PDF pages extract, copy, paste, C#.NET rotate PDF pages, C#.NET Abilities to zoom in and zoom out PDF page.
www.rasteredge.com
--retry
(Linux)
Linuxprovidesa
--retry
flagtokeeptryingtoopenafileifitdoesnotexists.
Thisiscommonlyused,withthe
-f
flag,andinthatusage,isequivalenttothe
-F
flag,whichOSX
supports.
Byitself,however,OSXhasnoequivalentflag,thoughyoucantriviallyapproximateitinamoreportable
fashionbywritingawhileloopinashellscriptthatrepeatedlychecksforthefileuntilitfindsit,then
runsthe
tail
command.
-s
and
--sleep-interval
(Linux)
Linuxprovides
-s
and
--sleep-interval
flagstolowerCPUusebyaddingadelaybetweenchecks
toseeifafileyouarewatchingwith
-f
hasgrown.
-v
(Linux)
Aswiththe
head
command,Linuxprovides
-v
and
-q
flags.Seehead (page 156)earlierinthissection
forexplanationoftheseflagsandsuggestedalternatives.
Inadditiontotheseflagdifferences,POSIXspecifiesthattheinputfilesfor
tail
mustbevalidtextfiles,which
meansthatallbytesequencesmustbevalidforthecurrentlocale.Althoughnotallversionsof
tail
enforce
thisrestriction,versionsthatdomayfailwhenusedwithbinaryfilesinsomeoperatingsystemsunlessyou
changethelocalsettings.
Ifyourscriptsmustprocessbinaryfiles,besuretospecifythe“C”localebeforeexecutingcommandsthatwork
withthesebinaryfiles.Tochangethelocale,issuethefollowingstatement:
export LANG="C"
Finally,unlikethe
head
command,POSIXdoesnotrequirethatthe
tail
commandbeabletostoreandprint
atextblockofarbitrarylength.Itrequiresonlythatthebuffersizebeatleast10timesthevalueof
LINE_MAX
.
Thevalueof
LINE_MAX
isimplementationdependent,butmustbeatleast2048bytes.
Whilethistheoretical20,480bytelimitintheoutputofthe
tail
commandisnotcommonlyenforcedin
modernoperatingsystems,theonlyguaranteedportablewaytogeneratelargerresultsfrom
tail
istouse
anothertoolsuchasAWK.
uudecode,uuencode
InmostLinuxandBSD-derivedoperatingsystems,
uudecode
appliesamaskof
0666
tofilemodes,thus
preventingthecreationofexecutablefiles(orfileswithotherspecialmodes).Inoperatingsystemsthatfollow
AT&Tsemantics,nomaskisapplied.
DesigningScriptsforCross-PlatformDeployment
GeneralCommand-LineToolDifferences
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
165
control software platform:C# WPF PDF Viewer SDK to view PDF document in C#.NET
Image from PDF Page. Image: Copy, Paste, Cut Image in PDF pages extract, copy, paste, C#.NET rotate PDF pages, C#.NET Abilities to zoom in and zoom out PDF page.
www.rasteredge.com
control software platform:C# PDF Form Data fill-in Library: auto fill-in PDF form data in C#
Free online C# sample code can help users to fill in fill in form field in specified position of adobe PDF file. Able to fill out all PDF form field in C#.NET.
www.rasteredge.com
Forconsistency,ifyourequiretheresultsof
uudecode
tobeexecutableorhavenonstandardmodes,your
scriptshouldsettheexecuteflagexplicitlywith
chmod
.
InoperatingsystemsthatfollowAT&Tsemantics,if
uudecode
overwritesanexistingfile,itcannotnecessarily
changeitsmodeunlessthefileisownedbythecurrentuseror
uudecode
isrunningastherootuser.
which
InOSX,the
which
commandcantakethe-sflagfor“silent”behavior.Inthismode,itdoesnotoutputany
textandreturnsanexitstatusof
0
ifthecommandexistsinanyofthepathslistedinthe
PATH
environment
variableor
1
ifitdoesnot(or
2
ifyoupassaninvalidflag).
ThisflagdoesnotexistinmanyoperatingsystemsthatobeyAT&Tsemantics.TheGNUversionof
which
used
inLinuxalsodoesnotsupportthisflag.Asanalternative,youcanredirecttheoutputof
which
to
/dev/null
asdescribedinPipesandRedirection (page 40).
Also,some(notall)LinuxdistributionscomewiththeGNU
which
command.Thiscommanddifferssignificantly
initsbehaviorfromotherUNIX-likeoperatingsystems.Inordertosupportsearchingformultiplecommands
inasingle
which
statement,itsexitstatuscontainsthenumberofcommandsthatwerenotfound,or-1if
youpassitunknownflags.(Italsosupportsanumberofformattingflagsthatarenotbroadlyavailable.)
Forreliablecross-platformuse,youshouldspecifyexactlyonecommandargumentatatime,passnoflags
(excepttheubiquitous
-a
flag,ifdesired),andassumethatanexitstatusofeither
-1
or
2
indicatesausage
error.
who
InoperatingsystemsthatfollowAT&Tsemantics,ifyouusethe
-u
flag,the
who
commanddisplaystheprocess
IDofthecorresponding
login
process.InoperatingsystemsthatfollowBSDsemantics,itdoesnotdisplay
theprocessID.
Compatibility Note:  YoucangettheBSDsemanticsinOSXv10.5byenablinglegacymodeas
describedinthe
compat
manualpage.
xargs
Ifyoupassthe
-L
flagtothe
xargs
command,
xargs
callsthespecifiedutilityeverytimeacertainnumber
oflinesareread.However,somedetailsdifferslightly:
DesigningScriptsforCross-PlatformDeployment
GeneralCommand-LineToolDifferences
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
166
control software platform:VB.NET PDF- HTML5 PDF Viewer for VB.NET Project
Remove Image from PDF Page. Image: Copy, Paste, Cut Image in NET comment annotate PDF, VB.NET delete PDF pages, VB.NET PDF page and zoom in or zoom out PDF page
www.rasteredge.com
control software platform:VB.NET PDF - WPF PDF Viewer for VB.NET Program
Image from PDF Page. Image: Copy, Paste, Cut Image in Online Guide for Using RasterEdge WPF PDF Viewer to View PDF pages, zoom in or zoom out PDF pages and go to
www.rasteredge.com
Counting:InoperatingsystemsthatfollowBSDsemantics,thenumberoflinesisbasedonthenumber
ofnewlinesencountered.Everyline(includingblanklines)iscounted.Inoperatingsystemsthatfollow
AT&TUNIXsemantics,blanklinesareignoredforcountingpurposes.
Concatenation:InoperatingsystemsthatfollowAT&TUNIXsemantics,anylineendingwithaspaceis
combinedwiththelinesthatfollowit,uptoandincludingthefirstnonblankline.Thisconcatenationdoes
notoccurinoperatingsystemsthatfollowBSDsemantics.
CombiningOptions:InoperatingsystemsthatfollowBSDsemantics,the
-L
and
-n
optionscanbeused
together.InoperatingsystemsthatfollowAT&TUNIXsemantics,the
-L
and
-n
optionsaremutually
exclusive,andthelastonegivenonthecommandlinewillbeused.
DesigningScriptsforCross-PlatformDeployment
GeneralCommand-LineToolDifferences
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
167
Shellscriptscanbepowerfultoolsforwritingsoftware.Graphicalinterfacesnotwithstanding,theyarecapable
ofperformingnearlyanytaskthatcouldbeperformedwithamoretraditionallanguage.Thischapterdescribes
severaltechniquesthatwillhelpyouwritemorecomplexsoftwareusingshellscripts.
UsingtheevalBuiltinforDataStructures,Arrays,andIndirection (page 168)describeshowtocreatecomplex
datastructuresinshellscripts.
ShellTextFormatting (page 176)tellshowtodotabularlayoutsanduseANSIescapesequencestoadd
colorandstylestoyourterminaloutput.
TrappingSignals (page 173)tellshowtowritesignalhandlersinshellscripts.
NonblockingI/O (page 191)andTimingLoops (page 194)showonewaytowritecomplexinteractivescripts
suchasgames.
BackgroundJobsandJobControl (page 197)explainshowtodocomplextasksinthebackgroundwhile
yourscriptcontinuestoexecute,includinghowtoperformsomebasicparallelcomputation.Italsoexplains
howtoobtaintheresultcodesfromthesejobsaftertheyexit.
ApplicationScriptingWithosascript (page 204)describeshowyourscriptcaninteractwithOSXapplications
usingAppleScript.
ScriptingInteractiveToolsUsingFileDescriptors (page 211)describeshowyoucanmakebidirectional
connectionstocommand-linetools.
NetworkingWithShellScripts (page 216)describeshowtousethe
nc
tool(otherwiseknownasnetcat)to
writeshellscriptsthattakeadvantageofTCP/IPsockets.
UsingtheevalBuiltinforDataStructures,Arrays,andIndirection
Oneofthemoreunder-appreciatedcommandsinshellscriptingisthe
eval
builtin.The
eval
builtintakesa
seriesofarguments,concatenatesthemintoasinglecommand,thenexecutesit.
Forexample,thefollowingscriptassignsthevalue
3
tothevariable
X
andthenprintsthevalue:
#!/bin/sh
eval X=3
echo $X
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
168
Advanced Techniques
Forsuchsimpleexamples,the
eval
builtinissuperfluous.However,thebehaviorofthe
eval
builtinbecomes
muchmoreinterestingwhenyouneedtoconstructorchoosevariablenamesprogrammatically.Forexample,
thenextscriptalsoassignsthevalue
3
tothevariable
X
:
#!/bin/sh
VARIABLE="X"
eval $VARIABLE=3
echo $X
Whenthe
eval
builtinevaluatesitsarguments,itdoessointwosteps.Inthefirststep,variablesarereplaced
bytheirvalues.Intheprecedingexample,theletter
X
isinsertedinplaceof
$VARIABLE
.Thus,theresultof
thefirststepisthefollowingstring:
X=3
Inthesecondstep,the
eval
builtinexecutesthestatementgeneratedbythefirststep,thusassigningthe
value
3
tothevariable
X
.Asfurtherproof,the
echo
statementattheendofthescriptprintsthevalue
3
.
The
eval
builtincanbeparticularlyconvenientasasubstituteforarraysinshellscriptprogramming.Itcan
alsobeusedtoprovidealevelofindirection,muchlikepointersinC.Someexamplesofthe
eval
builtinare
includedinthesectionsthatfollow.
AComplexExample:SettingandPrintingValuesofArbitraryVariables
Thenextexampletakesuserinput,constructsavariablebasedonthevalueenteredusing
eval
,thenprints
thevaluestoredintheresultingvariable.
#!/bin/sh
echo "Enter variable name and value separated by a space"
read VARIABLE VALUE
echo Assigning the value $VALUE to variable $VARIABLE
eval $VARIABLE=$VALUE
# print the value
eval echo "$"$VARIABLE
# export the value
AdvancedTechniques
UsingtheevalBuiltinforDataStructures,Arrays,andIndirection
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
169
eval export $VARIABLE
# print the exported variables.
export
Warning:  Thisscriptexecutesarbitraryuserinput.Itisintendedonlyasanexampleoftheusageof
the
eval
builtin.Inreal-worldcode,youshouldnever passunsanitizeduserinputdirectlyto
eval
becausedoingsocanprovideavectorforarbitrarycodeexecution.
Runthisscriptandtypesomethinglike
MYVAR 33
.Thescriptassignsthevalue
33
tothevariable
MYVAR
(or
whatevervariablenameyouentered).
Youshouldnoticethattheechocommandhasanadditionaldollarsign(
$
)inquotes.Thefirsttimethe
eval
builtinparsesthestring,thequoteddollarsignissimplifiedtomerelyadollarsign.Youcouldalsosurround
thisdollarsignwithsinglequotesorquoteitwithabackslash,asdescribedinQuotingSpecialCharacters (page
66).Theresultisthesame.
Thus,thestatement:
eval echo "$"$VARIABLE
evaluatesto:
echo $MYVAR
AdvancedTechniques
UsingtheevalBuiltinforDataStructures,Arrays,andIndirection
2014-03-10   |   Copyright © 2003, 2014 Apple Inc. All Rights Reserved.
170
Documents you may be interested
Documents you may be interested