07-10-2012
What is the expected output, based on the data provided?
Ps. The input data looks pretty random to me. Is there a formal file structure? Can you explain it?
There is no way that someone can write code to processs the sample input provided - it's full of abstracts and random comments.
Last edited by methyl; 07-10-2012 at 09:39 PM..
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Anyone is well-versed to use egrep to search a file for a line containing both:
1) AAA
2) $
I am having problem escaping the dollar sign when using egrep in conjunction with satisfying AAA as well.
E.g. Text file
Line 1 AAA
Line 2 $$$
Line 3 AAA BBB $
Line 4 $$$ BBB AA
will return me... (2 Replies)
Discussion started by: izy100
2 Replies
2. Shell Programming and Scripting
I would like to write a script which will read a file containing a list of filenames of the format as shown below :
/usr/local/packages/runcmdlinetool
/home/john.doe/sdfsdf/sdfsdfsd/sdfsdf/sdfsdfTemplates.xml
/usr/local/bin/gtar... (4 Replies)
Discussion started by: inditopgun
4 Replies
3. Shell Programming and Scripting
I am trying to do some thing like this ..
In a file , if pattern found insert new pattern at the begining of the line containing the pattern.
example:
in a file I have this.
gtrow0unit1/gctunit_crrownorth_stage5_outnet_feedthru_pin
if i find feedthru_pin want to insert !! at the... (7 Replies)
Discussion started by: pitagi
7 Replies
4. Shell Programming and Scripting
Hi,
I need to extract <APPNUMBER> tag alone, if the <college> haas IIT Chennai value. college tag value will have spaces embedded. Those spaces should not be suppresses.
My Source file
<Record><sno>1</sno><empid>E0001</empid><name>Rejsh suderam</name><college>IIT ... (3 Replies)
Discussion started by: Sekar1
3 Replies
5. UNIX for Dummies Questions & Answers
Hi
I want to search for a specific pattern in file
Say
ABC;HELLO_UNIX_WORLD;PQR
ABC;HELLO_UNIX_WORLD_IS_NOT_ENOUGH;XYZ
ABC;HELLO_UNIX_FORUM;LMN
Pattern to search is : "HELLO_UNIX_*****" and not "HELLO_UNIX_***_***_"
I mean after "HELLO_UNIX" there can only be one word.In this case... (2 Replies)
Discussion started by: dashing201
2 Replies
6. UNIX for Dummies Questions & Answers
Right now, my code is:
s/Secondary Ins./Secondary Ins.\
1/g
It's adding a 1 as soon as it finds Secondary Ins.
Primary Ins.: MEDICARE B DMERC Secondary Ins.
1: CONTINENTAL LIFE INS
What I really want to achieve is having a 1 added on the next line that contain "Secondary Ins." It... (4 Replies)
Discussion started by: newbeee
4 Replies
7. Shell Programming and Scripting
Hi everyone,
I have the following contents in a text file (as seen when viewed using vim):
one two three ^M
four five six ^M
seven
eight
nine ^M
ten eleven twelve ^M
(That is just a small portion of the file)
How can I obtain the following result?
one two three ^M
four five six ^M
seven... (2 Replies)
Discussion started by: gacanepa
2 Replies
8. UNIX for Dummies Questions & Answers
Hi all,
I am a newbie here. I have this requirement to find a file based on a pattern then return the filename if found.
I created a script based on online tutorials. Though, I am stuck & really appreciate if anyone can have a quick look & point me to the right direction?
#Script starts... (10 Replies)
Discussion started by: buster_t
10 Replies
9. Shell Programming and Scripting
Hi
I have a set of input strings in a pattern as given below
string1 string2 string3 string4 string5
I need to search this sequence of strings from a file in such a way that the first two strings (string1 and string2) and last two strings (string4 and string5) should match with the... (8 Replies)
Discussion started by: my_Perl
8 Replies
10. Shell Programming and Scripting
In the bash below I am searching the filevirus-scan.log for the Infected files: 0 line (in bold) and each line for OK.
If both of these are true then the function execute is automatically called and processing starts. If both these conditions are not meet then the line in the
file is sent to the... (2 Replies)
Discussion started by: cmccabe
2 Replies
LEARN ABOUT FREEBSD
random
RANDOM(6) BSD Games Manual RANDOM(6)
NAME
random -- random lines from a file or random numbers
SYNOPSIS
random [-elrUuw] [-f filename] [denominator]
DESCRIPTION
Random has two distinct modes of operations. The default is to read in lines from the standard input and randomly write them out to the
standard output with a probability of 1 / denominator. The default denominator for this mode of operation is 2, giving each line a 50/50
chance of being displayed.
The second mode of operation is to read in a file from filename and randomize the contents of the file and send it back out to standard out-
put. The contents can be randomized based off of newlines or based off of space characters as determined by isspace(3). The default
denominator for this mode of operation is 1, which gives each line a chance to be displayed, but in a random(3) order.
The options are as follows:
-e If the -e option is specified, random does not read or write anything, and simply exits with a random exit value of 0 to denominator
- 1, inclusive.
-f filename
The -f option is used to specify the filename to read from. Standard input is used if filename is set to '-'.
-l Randomize the input via newlines (the default).
-r The -r option guarantees that the output is unbuffered.
-U Tells random(6) that it is okay for it to reuse any given line or word when creating a randomized output.
-u Tells random(6) not to select the same line or word from a file more than once (the default). This does not guarantee uniqueness if
there are two of the same tokens from the input, but it does prevent selecting the same token more than once.
-w Randomize words separated by isspace(3) instead of newlines.
SEE ALSO
random(3), fortune(6)
HISTORY
The functionality to randomizing lines and words was added in 2003 by Sean Chittenden <seanc@FreeBSD.org>.
BUGS
No index is used when printing out tokens from the list which makes it rather slow for large files (10MB+). For smaller files, however, it
should still be quite fast and efficient.
BSD
February 8, 2003 BSD