Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Extract substring of unknown length from string Post 302282463 by radoulov on Saturday 31st of January 2009 09:05:53 AM
Old 01-31-2009
Do you want the filenames as a string value?
Something like this:
Code:
% hgLogOutput=" +0000 files: forum/web/hook-test.txt /forum/web/hook-test-2.txt description: test"
% f="${hgLogOutput#*files: }" f="${f% description*}"                                              
% printf "%s\n" "$f"                                                                              
forum/web/hook-test.txt /forum/web/hook-test-2.txt

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

command/script to extract a substring from a string

I have a long string "<ID type="Oid">{}</ID>" I need to extract "GigabitEthernet0/1" from the above string. How can it be done? :) (5 Replies)
Discussion started by: girisha
5 Replies

2. Shell Programming and Scripting

Using Awk in shell script to extract an index of a substring from a parent string

Hi All, I am new to this shell scripting world. Struck up with a problem, can anyone of you please pull me out of this. Requirement : Need to get the index of a substring from a parent string Eg : index("Sandy","dy") should return 4 or 3. My Approach : I used Awk function index to... (2 Replies)
Discussion started by: sandeepms17
2 Replies

3. Shell Programming and Scripting

perl newbie: how to extract an unknown word from a string

hi, im quite new to perl regexp. i have a problem where i want to extract a word from a given string. but the word is unknown, only fact is that it appears as the second word in the string. Eg. input string(s) : char var1 = 'A'; int var2 = 10; char *ptr; and what i want to do is... (3 Replies)
Discussion started by: wolwy_pete
3 Replies

4. Solaris

Extract substring from a string

i have srtring i.e. "NAME,CLASS,AGE" (length of string is not constant) and from this string i've extract each word delimited by "," (comma). INPUT: "NAME,CLASS,AGE" OUTPUT: NAME CLASS AGE how can i do that? i have tried some string manipulation function like... (5 Replies)
Discussion started by: jadoo_c2
5 Replies

5. Shell Programming and Scripting

Extract a string up to the first occurence of a substring

Hi, I'm a newbie to shell scripting and have searched the forum but couldn't find what i was looking for. Basically I have a list of filenames like... 123-fileone.txt I want to be able to extract the prefix up to the first '-'. So I'd end up with 123. I have attempted it using a pretty... (2 Replies)
Discussion started by: kirkg
2 Replies

6. Shell Programming and Scripting

Delimted to padded conversion with unknown field length

I’m looking for an elegant way to convert a delimited file (comma delimited in this case) to padded columns (for printing in non-proportional font) but the length of each column is not known ahead of time. It needs to be calculated for each column from the longest entry in that column in a given... (3 Replies)
Discussion started by: Michael Stora
3 Replies

7. Shell Programming and Scripting

How to extract a substring from a string

Hi, I have an input string say for example: ABC,DEF,IJK,LMN,...,XYZ The above string is comma delimited. Now I have to extract the last part after the comma i.e. XYZ. :b: (3 Replies)
Discussion started by: bghosh
3 Replies

8. Shell Programming and Scripting

Removing characters from end of line (length unknown)

Hi I have a file which contains wrong XML, There are some garbage characters at the end of line that I want to get rid of. Example: <request type="product" ><attributes><pair><name>q</name><value><!]></value></pair><pair><name>start</name><value>1</value></pair></attributes></request>�J ... (7 Replies)
Discussion started by: dirtyd0ggy
7 Replies

9. Shell Programming and Scripting

Extract substring specif position and length from file line

Hi gurus, I am trying to figure out how to extract substring from file line (all lines in file), as specified position and specified legth. Example input (file lines) dhaskjdsa dsadhkjsa dhsakjdsad hsadkjh dsahjdksahdsad sahkjd sahdkjsahd sajkdh adhjsak I want to extract substring on... (5 Replies)
Discussion started by: ProsteJa
5 Replies

10. Programming

C: inputting string of unknown length

I realize this general issue (inputting strings of variable length in C) has been addressed in myriad locations before, but I'm interested in knowing why my specific approach is not working. (BTW I'm intentionally keeping the size increments small so that I can more easily follow what's going on.... (5 Replies)
Discussion started by: DevuanFan
5 Replies
atsopt(1)						      General Commands Manual							 atsopt(1)

NAME
atsopt - ATS to C compiler SYNOPSIS
atsopt <command>... DESCRIPTION
atsopt is the compiler from ATS to C. It is most commonly invoked by atscc which is the preferred frontend for compiling ATS code. COMMANDS
atsopt takes a number of commands with parameters to determine its behavior: -d, --dynamic <filenames> Dynamically load the filenames. --debug=1 Enable generation of debugging information. -dep, --depgen Generate dependency lists. -h, --help Print the usage information. -o, --output <filename> Specify the output filename. --posmark_html Generate an HTML file with colored concrete syntax. --posmark_xref Generate an HTML file with syntactic cross-references. -s, --static <filenames> Statically load the filenames. -tc, --typecheck Typecheck the given ATS source files, but go no further. -v, --version Show ATS/Anairiats version and gcc version. EXAMPLES
atsopt -o test.c -d test.dats Compile test.dats to a C file. atsopt -tc -d test.dats Typecheck test.dats only. atsopt -o test.html -d test.dats --posmark_html Write a syntax colored version of test.dats. SEE ALSO
atscc(1), atslex(1). These programs are documented fully by The ATS/Anairiats user's manual available via the web at http://www.ats-lang.org/ AUTHOR
atsopt was written by Hongwei Xi. This manual page was written by Matthew Danish <mrd@debian.org>, for the Debian project (and may be used by others). February 22, 2010 atsopt(1)
All times are GMT -4. The time now is 06:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy