Help with script to read lines from file and count values
Hi, I need some help with a script I'm trying to write. I have a log file containing references to a number of different webservices. I wish to write a script that will list the webservices with a count as to how many times they appear in the log.
An example of the log file content:
So on the 1st line I wish to extract GetID, then the script would count how many instances of GetID there are in the log file.
ordinarily I would use the following if I was just wanting to search for a single entry:
Hi ,
I have a property file placed in folder /usr/opt/temp/aorc.prop which has values given below . I need to read this file content and replace the node with actual values in a shell script . Each time the script shall replace the node value from the poperty file and execute a cfsend command and... (10 Replies)
Hi,
I want to replace a chain of if-else statement in an old AWK file with values from Db2 table or CSV file. The part of code is below...
if (start_new_rec=="true"){
exclude_user="false";
user=toupper($6);
match(user, "XXXXX.");
if (RSTART ==2 ) {
... (9 Replies)
Hey everyone!
I have a tab delimited data set which I want to create an output contained the calculation of number of those lines with a certain value in 2nd and 3rd column.
my input file is like this:
ID1 1 10M AAATTTCCGG
ID2 5 4M ACGT
ID3 5 8M ACCTTGGA
ID4 5 ... (7 Replies)
For eg: I have sample.txt file with 4 rows of record like:
user1|password1
user2|password2
user3|password3
user4|password4
The username and password is sepsrated by '|'
I want to get the 1st row value from the file and assign it to two different variables(username and password)
in my... (1 Reply)
Hello,
I have 50 text files in a directory called "AllFiles"
I want to make a program that will go inside of the "AllFiles" Directory and count the number of lines in each individual text file. Then, the program will calculate how many more lines there are over 400 in each text file and... (7 Replies)
I'm learning about the read command and wrote this little script to read data from a file:
readfile()
{
while read variable; do
echo $variable
done
}
readfile < File.txt
I have three lines in File.txt; each a single word. The script only echoes the first two lines and drops the... (9 Replies)
Hello, I'm trying to create a BASH file that can read all the files in my working directory and tell me how many words and lines are in that file. I wrote the following code:
FILES="*"
for f in "$FILES"
do
echo -e `wc -l -w $f`
done
My issue is that my file is outputting in one... (4 Replies)
Hi All, I really need your help. I am a begginner in shell script and I believe this is a very simple issue.
I have in my directory, n-files, like 1.dhm, 2.dhm, 3.dhm.
These files have 1 column with 1 value per line, like:
1.dhm
------
10
20
30
40
50
2.dhm
------
30
50
20 (3 Replies)
I am attempting to itterate through a file that has multiple lines and for each one read the entire line and use the value then to search in other files. The problem is that instead of an entire line I am getting each word in the file set as the value I am searching for. For example in File 1... (2 Replies)