01-07-2013
Matching first n characters in a line in a file
hi to all,
i am writing a simple file program in C which has to take a string of length n as input and match that input string with first n character of the line in file. if it does not match it has to compare with first n characters of next line. i am finding it difficult to know how exactly to use fseek function to achieve this. please help...
thank you.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have file A with 10 lines and file B with 15 lines
I have to read each line from file A and match it with lines in file B
If matching lines are found i need to delete it from file B
The ouput will be the deleted file B
I tried the following in the loop but the deleting part is not... (5 Replies)
Discussion started by: codeman007
5 Replies
2. Shell Programming and Scripting
One file is
fileA
0.0246*0.0068*0.0013*0.0023*0.0182*0.0028*0.0019*0.4750*0.0028*0.0812*0.0123*0.0018*0.0039*0.0020*0.0028*0.0047*0.0139*0.3330*0.0017*0.0072*0.4789... (4 Replies)
Discussion started by: cdfd123
4 Replies
3. Shell Programming and Scripting
Hi there,
I have two input files. I need to match the last two columns of each line in File1 with the first two columns of a line in File2. Example:
File1
AAA BB 234 789
BBB CC 426 624
CCC DD 356 643
File2
766 332 12
234 789 64
122 633 23
426 624 88
777 453 22
356 643 92
... (3 Replies)
Discussion started by: palex
3 Replies
4. Shell Programming and Scripting
Hi
I am not the best scripter in the world and have run into a issue which you might be able to guide me on...
I have two files.
File1 :
A123, valueA, valueB
B234, valueA, valueB
C345, valueA, valueB
D456, valueA, valueB
E567, valueA, valueB
F678, valueA, valueB
File2:
C345,... (5 Replies)
Discussion started by: luckycharm
5 Replies
5. Shell Programming and Scripting
I have a LOG file which looks like this
Import started at: Mon Jul 23 02:13:01 EDT 2012
Initialization completed in 2.146 seconds.
--------------------------------------------------------------------------------
--
Import summary for Import item: PolicyInformation... (8 Replies)
Discussion started by: biztank
8 Replies
6. Shell Programming and Scripting
Hi,
I want to achieve something similar to what described in another post:
The difference is I want to add the line if the pattern is not found.
File 1:
A123, valueA, valueB
B234, valueA, valueB
C345, valueA, valueB
D456, valueA, valueB
E567, valueA, valueB
F678, valueA, valueB
... (11 Replies)
Discussion started by: jyu3
11 Replies
7. Shell Programming and Scripting
HI
Can any one guide me how to achieve this task. I have 2 files
env.txt
#Configuration.Properties values
identity_server_url = http://identity.test-hit.com:9783/identity/service/user/register
randon_password_length = 6
attachment_file_path = /pass/temp/attachments/... (1 Reply)
Discussion started by: nikilbr86
1 Replies
8. Shell Programming and Scripting
Hello,
I have two files file 1 and file 2 each having result of a query on certain database tables and need to compare for Col1 in file1 with Col3 in file2, compare Col2 with Col4 and output the value of Col1 from File1 which is a) not present in Col3 of File2 b) value of Col2 is different from... (2 Replies)
Discussion started by: RasB15
2 Replies
9. Shell Programming and Scripting
The awk below produces the current output, which will add +1 to $3. However, I am trying to add the length of the matching characters between $5 and $6 to $3. I have tried using sub as a variable to store the length but am not able to do so correctly. I added comments to each line and the... (4 Replies)
Discussion started by: cmccabe
4 Replies
10. UNIX for Beginners Questions & Answers
In the awk below I am trying to cp and paste each matching line in f2 to $3 in f1 if $2 of f1 is in the line in f2 somewhere. There will always be a match (usually more then 1) and my actual data is much larger (several hundreds of lines) in both f1 and f2. When the line in f2 is pasted to $3 in... (4 Replies)
Discussion started by: cmccabe
4 Replies
LEARN ABOUT DEBIAN
randtype
randtype(1) General Commands Manual randtype(1)
NAME
randtype - Output characters or lines at random intervals
SYNOPSIS
randtype [ -l ] [ -d ,|.<string> [ -k ] ] [ -t <ms,mult> ] [ -w <string> [ -c ms,mult ] ] [ -r s1,s2[:...] ] [ -n <string> ] [ -q <int> ]
[ -m <int> ] [ file ... ]
DESCRIPTION
randtype reads input from either standard input or from a file and outputs each character or line at random intervals. If multiple files
are specified, each is read in sequence.
OPTIONS
randtype recognizes the following command line options:
-c ms,mult
For optional use with the -w option, this has the same microsecond and multiplier value format as the -t option. The default for
this option is specified at compile time.
-d string
Output everything before (left) or after (right) the specified string immediately. The string must begin with either ',' or '.'
which specifies the direction, left or right, respectively.
-h Print a summary of the command line options and exit.
-k Suppress output of the string specified by the dump string option.
-l Output lines rather than characters. Only the -t and -q options are valid when using this option, all other options are ignored.
-m int Generate random mistakes. The int value is how many times to compare and match the next character and a randomly generated charac-
ter.
-n chars
Output the specified characters immediately with no random waiting.
-r s1,s2[:...]
Replace the string s1 with string s2. You can specify multiple replacements by separating them with a ':'.
-q int Quit the program after this many seconds.
-t ms,mult
This option refines the random delay of output. The value of the argument is separated by a comma with the first argument being a
microsecond and the second being a multiplier of a random number between 0 and the microsecond. A character-per-second effect can,
for example, be made by setting the microsecond to 0 and the multiplier to 1000000. The default for this option is specified at com-
pile time.
-v Display version information and exit.
-w chars
The inverse of the -n option; this option waits on the specified characters. Use the -c option to refine the random delay of output.
EXAMPLE
randtype -t 13,16000 -d ",*MAGIC*" -k -n '0ou' filename
SEE ALSO
random(3), srandom(3), alarm(2), select(2)
AUTHOR
This program was created by bjk <bjk@arbornet.org> and released under the terms of the GNU General Public License version 2 or later.
randtype randtype(1)