I am a beginner to Unix Shell Scripting We have source as a flat file which contains CTRL+F character as the delimiter. We need to count the number of records in the file (CTRL+F) to perform file validation Following command being used:
This takes only fewer seconds to show the count if the file contains less than 25K records. We have files with count exceeding 1000K and this command takes more than one hour to complete
Could you please suggest any other command similar to the above requirement and provide the count within fewer seconds / minutes. The commands can be either in Unix or Perl
Please help
Thanks & regards Sri
Last edited by radoulov; 09-03-2010 at 09:49 AM..
Reason: Code tags, please!
Hi everyone.
Could u be so kind and help me with on "simple" shell script?
1. i need to search a file line by line for a pattern.
example of a lines in that file
2947 domain = feD,id = 00 0A 02 48 17 1E 1D 39 DE 00 0E 00,Name
Values:snNo = f10
Add AttFlag = 0
2. i need to find... (0 Replies)
Hi all
I need to replace all characters in a file except for the matching pattern
eg.
I need to replace all character with '*' except for the pattern "abc"
Input
"sdfhgsdf abc ##%$#abcsdfh sdfjkfff"
Output
"******abc******abc*************"
Request for single liner solution (1 Reply)
Hello,
Despite reading the Pattern Matching chapter in the O'Reilly Sed & Awk book several times and
looking at numerous examples, I cannot seem to get any kind of conditional script to work in my awk scripts!
I am able to do the basic awk and grep script to capture the data but when I do with... (0 Replies)
Hi,
In my shell script i have to match a patten in a file , if found i have to prefix the entair line by a "word"
eg. pattern = "aaa" prefix= #123
file: bbbb xxx
zzzz aaaa
qqqq kkkk
outPut file: bbbb xxx
... (5 Replies)
Hi!
i'm trying to parse textfiles against a pattern and storing the result in a variable.
The strings i want to get are embraced by and can occur several times in one line, so e.g.
some text anything else endwhat i have so far:
#!/bin/bash
for f in $*
do
exec 3<&0
exec 0<$f
... (2 Replies)
I have file 1 & file 2 with content mentioned below. I want to get the output as shown in file3.
Requirement:
check the content of column 1 & column 2, if value of column 1 in file1 matches with first column of file2 then remaining columns(2&3) of file2 should get replaced, also if value of... (4 Replies)
Dear Unix Forums,
I am hoping you can help me with a pattern matching problem.
What am I trying to do?
I want to replace multiple lines of a text file (that match a multi-line pattern) with a single line of text. These patterns can span several lines and do not always have the same number of... (10 Replies)
I have an awk related question that I was hoping you all could help with.
I am given 2 input files named OLDFILE and NEWFILE, and a Master file named MASTERFILE. They can be seen below.
OLDFILE:
a
a
a
a
a
f
g
4
5
7
8
1
2
3 (1 Reply)
string="din&esh\nisgood"
File.txt:
the name is
sed "s#\#${string}#g" File.txt
Output am getting:
the name is dinesh
is good
Expected output:
the name is din&esh\nisgood
The input string is dynamic it will be keep on changing
am able to handle & by placing \& in the string.. (5 Replies)
Hi,
I want to know which pattern matching technique will be giving better performance and quick result.
I will be having the patterns in a file and want to read that patterns and search through a whole file of say 70 MB size. whether if i initially create a pattern matching string while... (7 Replies)