Sponsored Content
Top Forums Shell Programming and Scripting How to split the String based on condition? Post 302176781 by radoulov on Wednesday 19th of March 2008 07:32:42 AM
Old 03-19-2008
For the first part use this:

Code:
"${str%${str#*lotus}}"

for the second this:

Code:
"${str#*lotus}"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk script to split a file based on the condition

I have the file with the records like 4234234 US phone 3244234 US cup 2342342 CA phone 8947234 US phone 2389472 CA cup 2348972 US maps 3894234 CA phone I want the records with (US,phone) as record to be in one file, (Us, cup) in another file and (CA,cup) to be in another I mean all... (12 Replies)
Discussion started by: superprogrammer
12 Replies

2. Shell Programming and Scripting

searching and storing unknown number of lines based on the string with a condition

Dear friends, Please help me to resolve the problem below, I have a file with following content: date of file creation : 12 feb 2007 ==================== = name : suresh = city :mumbai #this is a blank line = date : 1st Nov 2005 ==================== few lines of some text this... (7 Replies)
Discussion started by: swamymns
7 Replies

3. Shell Programming and Scripting

split file with condition

$ cat file H1:12:90 k:12:b n:22:i k:54:b k:42:b s:48:s a:41:b t:18:n c:77:a I am trying to split above file based on $2 such that if $2 is rounded to nearest 10's multiple (e.g. 10,20,30 etc), each sub file should contain 3 multiples and so on (also I want to keep header i.e. NR==1, in... (6 Replies)
Discussion started by: uwork72
6 Replies

4. Shell Programming and Scripting

awk to print lines based on string match on another line and condition

Hi folks, I have a text file that I need to parse, and I cant figure it out. The source is a report breaking down softwares from various companies with some basic info about them (see source snippet below). Ultimately what I want is an excel sheet with only Adobe and Microsoft software name and... (5 Replies)
Discussion started by: rowie718
5 Replies

5. Shell Programming and Scripting

KSH: Split String into smaller substrings based on count

KSH HP-SOL-Lin Cannot use xAWK I have several strings that are quite long and i want to break them down into smaller substrings. What I have String = "word1 word2 word3 word4 .....wordx" What I want String1="word1 word2" String2="word 3 word4" String3="word4 word5" Stringx="wordx... (5 Replies)
Discussion started by: nitrobass24
5 Replies

6. Shell Programming and Scripting

A command to split a file into two based on a string

Hello What command can i use to split a tab delimited txt file into two files base on the occurrence of a string my file name is EDIT.txt The content of file is below XX 1234 PROCEDURES XY 1634 PROCEDURES XM 1245 CODES XZ 1256 CODES It has more than a million record If there is... (16 Replies)
Discussion started by: madrazzii
16 Replies

7. Shell Programming and Scripting

How to Split File based on String?

hi , The scenario is like this, i have a large text files (max 5MB , about 5000 file per day ), Inside almost each line of this file there is a tag 3100.2.22.1 (represent Call_Type) , i need to generate many filess , each one with distinct (3100.2.22.1 Call_Type ) , and one more file to... (3 Replies)
Discussion started by: OTNA
3 Replies

8. Shell Programming and Scripting

How to Split File to 2 depending on condition?

Hi , cat myfile.txt ! 3100.2.0.5 ! 3100.2.22.4 ! 3100.2.30.33 ! 3100.2.4.1 ! ! 3100.2.0.5 ! 3100.2.22.4 ! 3100.2.22.11 ! 3100.2.4.1 ! ! 3100.2.0.5 ! 3100.2.2.50 ! 3100.2.22.11 ! 3100.2.4.1 ! ! 3100.2.0.5 ! 3100.2.22.4 ! 3100.2.30.33 ! 3100.2.4.1 ! ! 3100.2.0.5 ! 3100.2.22.4 !... (6 Replies)
Discussion started by: OTNA
6 Replies

9. UNIX for Dummies Questions & Answers

Condition based on Timestamp (Date/Time based) from logfile (Epoch seconds)

Below is the sample logfile: Userids Date Time acb Checkout time: 2013-11-20 17:00 axy Checkout time: 2013-11-22 12:00 der Checkout time: 2013-11-17 17:00 xyz Checkout time: 2013-11-19 16:00 ddd Checkout time: 2013-11-21 16:00 aaa Checkout... (9 Replies)
Discussion started by: asjaiswal
9 Replies

10. UNIX for Beginners Questions & Answers

awk do not split if condition is meet

Trying to use awk to format the input based on the filed count being 5. Most lines are fine using the awk below, except the first two lines. I know the reason is the -1 in green and -2 in blue. But can not figure out how to not split on the - if it is followed by a digit then letter. Thank you :).... (1 Reply)
Discussion started by: cmccabe
1 Replies
x86_init(3)							     libdisasm							       x86_init(3)

NAME
x86_init, x86_cleanup - initialize and cleanup libdisasm SYNOPSIS
#include <libdis.h> typedef void (*DISASM_REPORTER)( enum x86_report_codes code, void * data, void * arg ); int x86_init( enum x86_options options, DISASM_REPORTER reporter, void * arg); int x86_cleanup(void); DESCRIPTION
enum x86_options { opt_none= 0, opt_ignore_nulls=1, /* ignore sequences of > 4 NULL bytes */ opt_16_bit=2, /* 16-bit/DOS disassembly */ opt_unknown }; enum x86_report_codes { report_disasm_bounds, report_insn_bounds, report_invalid_insn, report_unknown }; EXAMPLES
The following provides a skeleton for initializing and terminating libdisasm: void reporter( enum x86_report_codes code, void *data, void *arg ) { char * str = NULL; FILE *stream = (FILE *) arg; if (! stream ) stream = stderr; /* here would could examine the error and do something useful; * instead we just print that an error occurred */ switch ( code ) { case report_disasm_bounds: str = "Attempt to disassemble RVA " "beyond end of buffer"; break; case report_insn_bounds: str = "Instruction at RVA extends " "beyond buffer"; break; case report_invalid_insn: str = "Invalid opcode at RVA"; break; case report_unknown: str = "Unknown Error"; break; } fprintf(stream, "ERROR '%s:' %p0, str, data); } int main( int argc, char **argv ) { x86_init(opt_none, reporter, stderr); /* disassembler code goes here */ x86_cleanup(); } SEE ALSO
libdisasm(7), x86_disasm(3), x86_format_insn(3), x86dis(1) mammon_ 0.21 x86_init(3)
All times are GMT -4. The time now is 03:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy