Sponsored Content
Top Forums Shell Programming and Scripting Break a file into smaller pieces with same search string Post 303023869 by Don Cragun on Tuesday 25th of September 2018 05:16:46 AM
Old 09-25-2018
We obviously have a little bit of a language barrier here. I have no idea what "remove the expression receptively" means. So, I do not know what output you want to place into any of your output files.

Since you can't do arithmetic in sed, you'll probably want to process your input file directly in the shell or use something like awk or perl.

Can we assume that every input line containing <expression> will have a line following it containing </expression>?

Please try to come up with something that does what you want and show us what you have tried to get there. And, please show us exactly what output you hope to produce in each of the output files you want to produce from your sample input!
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to insert line break + string in vi (search & replace )

Hello all i have big test file that has allot of structure text something like this : <foo1 *.html> <blah action> somthing 1 somthing 2 </blah> </foo1 > now i will like to insert 2 more lines of text below the <blah action> so it will be like : <foo1... (1 Reply)
Discussion started by: umen
1 Replies

2. Shell Programming and Scripting

appending string to text file based on search string

Hi, I need to append string "Hi" to the beginning of the lines containing some specific string. How can I achieve that? Please help. Malay (1 Reply)
Discussion started by: malaymaru
1 Replies

3. Shell Programming and Scripting

search string in a file and retrieve 10 lines including string line

Hi Guys, I am trying to write a perl script to search a string "Name" in the file "FILE" and also want to create a new file and push the searched string Name line along with 10 lines following the same. can anyone of you please let me know how to go about it ? (8 Replies)
Discussion started by: sukrish
8 Replies

4. UNIX for Dummies Questions & Answers

add a string to a file without line break

I searched and found "echo -n" and "printf" are solution for this, but they are not here: $ echo "hello" >> test $ cat test hello $ echo -n "world" >> test $ cat test hello world $ echo -n " seriously?" >> test $ cat test hello world seriously? This is not successful... (15 Replies)
Discussion started by: stunn3r
15 Replies

5. Shell Programming and Scripting

Search a string in a text file and add another string at the particular position of a line

I am having a text file which is having more than 200 lines. EX: 001010122 12000 BIB 12000 11200 1200003 001010122 2000 AND 12000 11200 1200003 001010122 12000 KVB 12000 11200 1200003 In the above file i want to search for string KVB and add/replace... (1 Reply)
Discussion started by: suryanarayana
1 Replies

6. Shell Programming and Scripting

Search a string in a text file and add another string at the end of line

Dear All I am having a text file which is having more than 200 lines. EX: 001010122 12000 BIB 12000 11200 1200003 001010122 2000 AND 12000 11200 1200003 001010122 12000 KVB 12000 11200 1200003 In the above file i want to search for string KVB... (5 Replies)
Discussion started by: suryanarayana
5 Replies

7. Shell Programming and Scripting

Search string within a file and list common words from the line having the search string

Hi, Need your help for this scripting issue I have. I am not really good at this, so seeking your help. I have a file looking similar to this: Hello, i am human and name=ABCD. How are you? Hello, i am human and name=PQRS. I am good. Hello, i am human and name=ABCD. Good bye. Hello, i... (12 Replies)
Discussion started by: royzlife
12 Replies

8. UNIX for Dummies Questions & Answers

Search for a string,delete the line and replace with new string in a file

Hi Everyone, I have a requirement in ksh where i have a set of files in a directory. I need to search each and every file if a particular string is present in the file, delete that line and replace that line with another string expression in the same file. I am very new to unix. Kindly help... (10 Replies)
Discussion started by: Pradhikshan
10 Replies

9. UNIX for Beginners Questions & Answers

Search a string and display its location on the entire string and make a text file

I want to search a small string in a large string and find the locations of the string. For this I used grep "string" -ob <file name where the large string is stored>. Now this gives me the locations of that string. Now how do I store these locations in a text file. Please use CODE tags as... (7 Replies)
Discussion started by: ANKIT ROY
7 Replies

10. UNIX for Beginners Questions & Answers

Search partial string in a file and replace the string - UNIX

I have the below string which i need to compare with a file and replace this string in the file which matches closely. Can anyone help me on this. string(Scenario 1)- user::r--,user::ourfrd:r-- String(Scenario 2)- user::r-- File **** # file: /local/Desktop/myfile # owner: me # group:... (6 Replies)
Discussion started by: sarathy_a35
6 Replies
autodia(3pm)						User Contributed Perl Documentation					      autodia(3pm)

NAME
autodia - a perl script using the Autodia modules to create UML Class Diagrams or documents. from code or other data sources. INTRODUCTION
AutoDia takes source files as input and using a handler parses them to create documentation through templates. The handlers allow AutoDia to parse any language by providing a handler and registering in in autodia.pm. The templates allow the output to be heavily customised from Dia XML to simple HTML and seperates the logic of the application from the presentation of the results. AutoDia is written in perl and defaults to the perl handler and file extension matching unless a language is specified using the -l switch. AutoDia requires Template Toolkit and Perl 5. Some handlers and templates may require additional software, for example the Java SDK for the java handler. AutoDia can use GraphViz to generate layout coordinates, and can produce di-graphs (notation for directional graphs) in dot (plain or canonical) and vcg, as well as Dia xml. Helpful information, links and news can be found at the autodia website - http://www.aarontrevena.co.uk/opensource/autodia/ USAGE
"autodia ([-i filename [-p path] ] or [-d directory [-r] ]) [options]" "autodia -i filename : use filename as input" "autodia -i 'filea fileb filec' : use filea, fileb and filec as input" "autodia -i filename -p .. : use ../filename as input file" "autodia -d directoryname : use *.pl/pm in directoryname as input files" "autodia -d 'foo bar quz' : use *pl/pm in directories foo, bar and quz as input files" "autodia -d directory -r : use *pl/pm in directory and its subdirectories as input files" "autodia -d directory -F : use files in directory but only one file per diagram" =item "autodia.pl -d directory -C : use files in directory but skip CVS directories" "autodia -o outfile.xml : use outfile.xml as output file (otherwise uses autodial.out.dia)" "autodia -O : output to stdout" "autodia -l language : parse source as language (ie: C) and look for appropriate filename extensions if also -d" "autodia -t templatefile : use templatefile as template (otherwise uses template.xml)" "autodia -l DBI -i "mysql:test:localhost" -U username -P password : use test database on localhost with username and password as username and password" "autodia -l Mason -i "/index.html" -p comp_root -G '$c' : use HTML::Mason to fetch /index.html from comp_root and show all components in reach. -G corresponds to allow_globals." "autodia -z : output via graphviz" "autodia -Z : output via springgraph" "autodia -v : output via VCG " "autodia -s skipfile : exclude files or packagenames matching those listed in file" c<autodia -D : ignore dependancies (ie do not process or display dependancies)> "autodia -K : do not display packages that are not part of input" "autodia -k : do not display superclasses that are not part of input" "autodia -H : show only Public/Visible methods" "autodia -m : show only Class methods" "autodia -M : do not show Class Methods" "autodia -a : show only Class Attributes" "autodia -A : do not show Class Attributes" "autodia -S : silent mode, no output to stdout except with -O" "autodia -h : display this help message" "autodia -V : display version and copyright message" perl v5.12.4 2011-05-23 autodia(3pm)
All times are GMT -4. The time now is 08:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy