Sponsored Content
Full Discussion: extracting substrings
Top Forums Shell Programming and Scripting extracting substrings Post 302264950 by otheus on Friday 5th of December 2008 07:48:25 AM
Old 12-05-2008
Code:
awk '/^>/ { last=$0; next; } !/^>/ { print last,substr($0,10,30);' }

In the unlikely case that awk reports that it doesn't know about "substr", use "nawk", "mawk", or "gawk".

Also, you said 10 - 40. I'm assuming that means starting at the 10th character and stopping but including the 39th character.
 

10 More Discussions You Might Find Interesting

1. Programming

Accessing substrings by offset and length

Hi, I have a simple question... In C do we have a standard library function which will return the pointer to a substring at certain offset and having certain length... Ofcourse we should take care not to access beyond allocated length in the parent string and don't overwrite beyond allocated... (2 Replies)
Discussion started by: Vishnu
2 Replies

2. Shell Programming and Scripting

Breaking strings into Substrings

I'm only new to shell programming and have been given a task to do a program in .sh, however I've come to a point where I'm not sure what to do. This is my code so far: # process all arguments (i.e. loop while $1 is present) while ; do # echo "Arg is $1" case $1 in -h*|-H*) echo "help... (4 Replies)
Discussion started by: switch
4 Replies

3. Shell Programming and Scripting

Extract large list of substrings

I have a very long string (millions of characters). I have a file with start location and length that is thousands of rows long: Start Length 5 10 16 21 44 100 215 37 ... I'd like to extract the substring that corresponds to the start and length from each row of the list: I tried... (7 Replies)
Discussion started by: dcfargo
7 Replies

4. AIX

Substrings and the likes in AIX 4.2 ?

In AIX 4.2, are there any shell commands to do substrings and the text like manipulation commands ? I want to take an error log where errors are multi-ligned and convert them into single lines to ease tracking/monitoring. I may need to shorten them out too. If I can manage to put them into an... (2 Replies)
Discussion started by: Browser_ice
2 Replies

5. Shell Programming and Scripting

extracting substrings from variables

Hello Everyone, I am looking for a way to extract substrings to local variables. Here is the format of the string variable i am using : /var/x/www && /usr/x/share/doc && /etc/x/logs where the substrings i must extract are the "/var/x/www" and such. I was originally thinking of using... (15 Replies)
Discussion started by: jimmy75_13
15 Replies

6. Shell Programming and Scripting

Extract three substrings from a logfile

I have a log file like below. 66.249.73.11 - - "UCiZ7QocVqYAABgwfP8AAHAA" "US" "Mediapartners-Google" "-" www.mahashwetha.com.sg "GET... (2 Replies)
Discussion started by: Tuxidow
2 Replies

7. UNIX for Dummies Questions & Answers

Replace substrings in awk

Hi ! my input looks like that: --AAA-AAAAAAA---------AA- AAA------AAAAAAAAAAAAAA ------A----AAAA-----A------- Using awk, I would need to replace only the "-" located between the last letter and the end of the string by "~" in order to get: --AAA-AAAAAAA---------AA~... (7 Replies)
Discussion started by: beca123456
7 Replies

8. Shell Programming and Scripting

Extracting substrings from a string of variable length

I have a string like Months=jan feb mar april x y .. Here the number of fields in Months is not definite I need to extract each field in the Months string and pass it to awk . Don't want to use for in since it is a loop . How can i do it (2 Replies)
Discussion started by: Nevergivup
2 Replies

9. Shell Programming and Scripting

Finding most common substrings

Hello, I would like to know what is the three most abundant substrings of length 6 from col2. The file is quite large and looks like this col1 col2 EN03 typehellobyedogcatcatdog EN09 typehellobyebyebyebye EN08 dogcatcatdogbyebyebyebye EN09 catcattypehellobyebyebyebye... (9 Replies)
Discussion started by: verse123
9 Replies

10. Shell Programming and Scripting

Look for substrings with special characters

Hello gurus, I have a lookup table cat tmp1 \\\erw``~ 1 ^774574574565665f\] 2 ()42543^ and I`m trying to compare a bunch of strings such that, either the lookup table column 1, or the string to be looked up are substrings of each other (and return the second lookup column if yes). ... (2 Replies)
Discussion started by: sheetalk
2 Replies
ORANGE(1)							   User Commands							 ORANGE(1)

NAME
orange - extract CAB files from self-extracting installers DESCRIPTION
orange [-d DIRECTORY] [-D LEVEL] [-h] FILENAME -d DIRECTORY Extract files to DIRECTORY -D LEVEL Set debug log level 0 - No logging (default) 1 - Errors only 2 - Errors and warnings 3 - Everything -h Show this help message FILENAME The file to list or extract contents of Orange is a tool and library for squeezing out juicy installable Microsoft Cabinet Files from self-extracting installers for Microsoft Win- dows. It currently supports the following kinds of installers: * Early support for installers created by Installer VISE. (Orange 0.3 or later) * Support for some installers created by Inno Setup. (Orange 0.2 or later) * Early support for the installer used by TomTom prod- ucts. (Orange 0.2 or later) * InstallShield versions 5 and 6, using Unshield for extracting InstallShield Cabinet files. * Setup Factory versions 5 and 6 using Dynamite for data decompression. * Some other installer (using a DLL called inflate.dll). This is used by for example Macromedia Flash Player 6 for Pocket PC 2002. * Microsoft Cabinets (also self-extracting) when you have Cabextract installed. * Zip archives (also self-extracting) when you have UnZip installed. orange 0.3.1 July 2004 ORANGE(1)
All times are GMT -4. The time now is 12:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy