Sponsored Content
Top Forums Shell Programming and Scripting Deleting part of a string enclosed in brackets Post 302338771 by pcwiz on Tuesday 28th of July 2009 10:24:42 PM
Old 07-28-2009
Deleting part of a string enclosed in brackets

I use otool on OS X to figure out the shared libraries that a binary uses. I run this command:

otool -L /Applications/Vidnik\ 0.13.0/Vidnik.app/Contents/MacOS/Vidnik

And it returns an output similar to this:

Code:
/Applications/Vidnik 0.13.0/Vidnik.app/Contents/MacOS/Vidnik:
	/usr/lib/libcrypto.0.9.7.dylib (compatibility version 0.9.7, current version 0.9.7)
	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 12.0.0)
	/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 677.15.0)
	/System/Library/Frameworks/QuickTime.framework/Versions/A/QuickTime (compatibility version 1.0.0, current version 67.0.0)
	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.5.1)
	/System/Library/Frameworks/QTKit.framework/Versions/A/QTKit (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 33001.0.0)
	@executable_path/../Frameworks/Sparkle.framework/Versions/A/Sparkle (compatibility version 1.5.0, current version 1.5.0)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.0.0)
	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 32.0.0)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 476.10.0)
	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 949.27.0)
	/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 34.0.0)

What I need to do is completely delete the first line of the output (this line: /Applications/Vidnik 0.13.0/Vidnik.app/Contents/MacOS/Vidnik:) and on each following line that lists a library, I need to delete the part in brackets (e.g. something like "(compatibility version x.x.x., current version, x.x.x)"). And then I need to delete any line that begins with "@executable_path". I know this is a long one, but I hope its possible

Any help would be appreciated

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

substitution of string in brackets

Hi friends! I have a tab delimited file with two columns : GB_45_DRB SP:0139466(mrmi sisignm)|SP:3674(fllflg_itoioh)|SP:68954779(RMTKLGF to emmdm-roomto) GB_45_DRD SP:475928(mgmdksi rikgkg)|SP:587959(roykgl tiic-tm)|SP:0139466(mrmi sisignm)|SP:3674(fllflg_itoioh)|SP:68954779(RMTKLGF to... (4 Replies)
Discussion started by: jacks
4 Replies

2. Shell Programming and Scripting

How to substitute brackets in the beginning of string in perl?

Hi, I have a string like this user can specify different query sets that is why "or" is mentioned: $string="]("; or $string="](("; or $string="]((("; or $string="]((((("; (1 Reply)
Discussion started by: vanitham
1 Replies

3. UNIX for Advanced & Expert Users

grep string containing [] brackets

Hello, I am trying to grep string with square brackets. for example I want to grep the below string in log.txt file. This is a test thanks in advance. (2 Replies)
Discussion started by: sureshcisco
2 Replies

4. UNIX for Dummies Questions & Answers

Deleting part of file names

My server got messed up and the names of my files were not completely processed. As results I ended up getting a bunch of files with the following names: I need to remove the underscore and everything before it. Thus, the files will be renamed to something like this: Any help will be greatly... (3 Replies)
Discussion started by: Xterra
3 Replies

5. Shell Programming and Scripting

Deleting part of a string : string manipulation

i have something like this... echo "teCertificateId" | awk -F'Id' '{ print $1 }' | awk -F'te' '{ print $2 }' Certifica the awk should remove 'te' only if it is present at the start of the string.. anywhere else it should ignore it. expected output is Certificate (7 Replies)
Discussion started by: vivek d r
7 Replies

6. Homework & Coursework Questions

Sed, matching nested brackets and deleting

1. The problem statement, all variables and given/known data: I have to write a script using sed, which delete everything between curly brackets and the brackets themself. The brackets might be nested. The input-file is: aaa { bbb ccc { ddd eee } fff { ... (2 Replies)
Discussion started by: FuzzyGnome
2 Replies

7. Shell Programming and Scripting

How to delete a column/columns of a CSV file which has cell values with a string enclosed in " , "?

How can I delete a column from a CSV file which has comma separated value with a string enclosed in double quotes and a comma in between? I have a file 44.csv with 4 lines including the header like the below format: column1, column2, column3, column 4, column5, column6 12,455,"string with... (6 Replies)
Discussion started by: dhruuv369
6 Replies

8. Shell Programming and Scripting

How to delete the commas in a .CSV file that are enclosed in a string with double quotes?

Okay, I would like to delete all the commas in a .CSV file (TEST.CSV) or at least substitute them with empty space, that are enclosed in double quote. Please see the sample file as below: column 1,column 2,column 3,column 4,column 5,column 6,column 7,column 8,column 9,column 10... (8 Replies)
Discussion started by: dhruuv369
8 Replies

9. Shell Programming and Scripting

How to delete a columns of a CSV file which has cell values with a string enclosed in " , "?

Hi How can I delete a columns from a CSV file which has comma separated value with a string enclosed in double quotes or square bracket and a comma in between? I have a csv file with below format. Template,Target Server,Target Component,Rule Group,Rule,Rule Reference Number,Rule... (7 Replies)
Discussion started by: Litu19
7 Replies

10. Shell Programming and Scripting

Issue catching/reading 2 digits and 3 letter string between brackets

Hello I'm writing a handler for ffmpeg, and having troubles to catch some exceptions that may occour with certain files. In order to parse for video & subtitle maps, i've had to make the raw data easier to handle, until now this worked well, but basicly i've just been lucky... The input... (1 Reply)
Discussion started by: sea
1 Replies
GEN_BRIDGE_METADATA(1)					    BSD General Commands Manual 				    GEN_BRIDGE_METADATA(1)

NAME
gen_bridge_metadata -- Objective-C Bridges Metadata Generator SYNOPSIS
gen_bridge_metadata [options...] headers... DESCRIPTION
gen_bridge_metadata is a tool that generates bridging metadata information for a given framework or set of headers. The Objective-C bridges supported in Mac OS X, such as PyObjC (Python), read this information at runtime. As of Mac OS 10.7, gen_bridge_metadata uses an improved parser, based on clang. This means the generated files should be more correct and complete, and the true parsing allows the automatic extraction of metadata from existing __attribute__() information supported by the com- piler. File generation time should also be faster. Metadata files describe the parts of an Objective-C framework that the bridges cannot automatically handle. These are primarily the ANSI C elements of the framework -- functions, constants, enumerations, and so on -- but also include special cases such as functions or methods that accept pointer-like arguments. These special cases must be manually specified in separate files called exceptions. The gen_bridge_metadata tool can then read in the exceptions file when it generates the framework metadata. The file extension used for metadata files should be .bridgesupport. Certain elements, such as inline functions, cannot be described in the metadata files. It is therefore required to generate a dynamic library in order to make the bridges use them. The gen_bridge_metadata tool can take care of that for you. The file extension for the dynamic libraries should be .dylib. You should install metadata files in one of three filesystem locations. For example, for a framework named MyFramework that is installed as /Library/Frameworks/MyFramework.framework, you can install the MyFramework.bridgesupport and MyFramework.dylib files in one of the following possible locations, in order of priority: o /Library/Frameworks/MyFramework/Resources/BridgeSupport o /Library/BridgeSupport o ~/Library/BridgeSupport OPTIONS
The gen_bridge_metadata tool accepts the following command-line options: -f framework, --framework framework Generates metadata for the given framework. This argument can accept both the name of a framework of an absolute path to a framework. When passing a framework name, the program will try to locate the framework in one of the standard framework locations. -p, --private Generates metadata based on the private headers of the given frameworks. This argument must be used with the -f argument. -F format, --format format Selects the metadata format that will be generated. Possible values are: final The final metadata format. This is the default value. dylib The dynamic library format. This is only required if you want to support inline functions. In order to use this format you need to pass a value for the -o argument. exceptions-template This will generate an exception template. Please consult BridgeSupport(5) for more details about the exception for- mat. Once your exception file is finished you can pass it to the -e argument in order to generate the final meta- data. -e file, --exception file Considers the given exception file when generating the final metadata format. The given exception file must conform to a certain format, described in bridgeSupport(5). Exception files are manually written, but you can generate a template by passing -F exceptions-template to the generator. --64-bit (This option is included for backwards compatibility, as this is now the default behavior.) Writes both 32 and 64-bit annotations to the final metadata format and compiles the dylib both 32 and 64-bit (if a framework is specified and it only contains either 32 or 64-bit architectures, then the final metadata format and dylib will be created only for that architecture). In order to use this option you need to run the generator on a 64-bit machine. The generation will take a bit more than twice the time, as both 32 and 64-bit will need to be processed and merged into one. --no-32-bit Do not write the 32-bit annotations to the final metadata format or compile the dylib 32-bit. May not be used with --no-64-bit. --no-64-bit Do not write the 64-bit annotations to the final metadata format or compile the dylib 64-bit. May not be used with --no-32-bit. -c, --cflags flags Provides custom flags that will be passed to the C compiler. The generator compiles and executes several C and Objective-C programs dur- ing the generation of the final metadata format. Some flags are determined by default, but you might want to provide your own flags according to the piece of code you want to generate metadata for (for example, a framework part of a umbrella framework). -C, --cflags-64 flags Provides custom flags that will be passed to the C compiler, when generating 64-bit annotations. By default the same flags are passed to the C compiler when generating both 32-bit and 64-bit annotations. -o, --output file Writes the output to the given file. This argument is mandatory when generating the ``dylib'' format. For other formats, by default the output is redirected to the standard output. -h, --help Prints a summary of the options. -d, --debug Turns on debugging messages. You probably don't want to enable this option, unless you are going to debug the metadata generator. -v, --version Shows the version of the program. The version is also marked in generated metadata files, as the ``version'' attribute of the ``signatures'' top-level element. EXAMPLES
This generates bridge support metadata for a custom framework: mkdir -p /Path/To/YourFramework.framework/Resources/BridgeSupport gen_bridge_metadata -f /Path/To/YourFramework.framework -o /Path/To/YourFramework.framework/Resources/BridgeSupport/YourFramework.bridgesupport If the custom framework has inline functions and you want to be able to call them, here is how you can generate a ``dylib'' file: gen_bridge_metadata -f /Path/To/YourFramework.framework -F dylib -o /Path/To/YourFramework.framework/Resources/BridgeSupport/YourFramework.dylib It is also possible to generate bridge support metadata for a standalone C library (here, libcurl): gen_bridge_metadata -c '-lcurl -I/usr/include/curl' /usr/include/curl/*.h > /Library/BridgeSupport/curl.bridgesupport SEE ALSO
BridgeSupport(5) /System/Library/DTDs/BridgeSupport.dtd ruby(1) python(1) BSD
May 24, 2010 BSD
All times are GMT -4. The time now is 06:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy