I have a bit of a problem with a loop that extracts repetitive text.
Running /bin/index executable outputs this text to terminal:
My goal is to eval the command and pull the blue values from text, in a loop, and print them as a set:
The first issue I have is: I don't know how to filter the index title with awk (i.e. 'scanthread', with or without quotes, it does not matters).
Second, if I print the $records in the loop, it will print 6 times (the wrong value), instead of 3?
No, it does not. The index names are just an example, they could be anything:
index[0]="testalpha"
index[1]="johndoe"
index[2]="dancedance"
Just to clarify better what I try to achieve:
I have a script that generates an array that contains index names, for example: index[0]="testalpha"
index[1]="johndoe"
index[2]="dancedance"
Then, the script executes the command ($1 is actually ${index[*]}): $indexer --config $CONF_PATH --run $1
The above line will output the following test to terminal:
As you can see, each index is associated with this text format: testing index 'johndoe'...
collected 1 docs, 0.0 MB
... more lines here ...
total 1 docs, 28 bytes
total 0.016 sec, 1725 bytes/sec, 61.62 docs/sec
My goal is to create a loop that will associate the blue values to variables.
Line: testing index 'johndoe'...
should grab the 'johndoe' text and assign it to $index variable.
Line: total 1 docs, 28 bytes
should grab the 1 and 28 values and assign them to $records and $size variables.
* the format of those lines never changes, so we can use the words as delimiters.
Then, still in the loop, I can simply print the variables or use them the way I like.
Code prototype:
The output should be: 'testalpha' 0 0
'johndoe' 1 28
'dancedance' 0 0
Hi,
I have a file(input.txt) and trying to format as output.txt. See the attached file format.
Note: This is a windows file (DOS format) and the commands are also going to execute on windows.
Basically I am trying to capture all the data in between Local Group Memberships and Global Group... (10 Replies)
I need to grab information from the output of the ps command.
For each line of ps output that contains _progres -b I need to get the word that follows -p. The "-p" can be anywhere after "_progres -b".
Using grep to select the correct lines is no problem (e.g. ps -ef|grep "_progres \-b|grep -v... (3 Replies)
Dear Friends,
I am in urgent need for awk/sed/sh script for converting a specific data format (.txt) to .xls.
The input is as follows:
>gi|1234|ref|
Query = 1 - 65, Target = 1677 - 1733
Score = 8.38, E = 0.6529, P = 0.0001513, GC = 46
fd sdfsdfsdfsdf
fsdfdsfdfdfdfdfdf... (6 Replies)
Hi,
I have a file with multiple columns and for column 5 I want to extract that row into another file if it is equal to or greater than a certain value.
For example:
FAR 4 5 7 LOP
GAT 3 3 3 POL
I want values that are greater than 5 for column 4. So the final file will look like... (1 Reply)
For people who want to pull a number of lines from a long file using a specific formula
n (number of iterations in a loop)
a (offset number)
b (stretch factor)
example with n {1..100}
for (( n=1; n<101; n++ )); do awk -v n=$n 'NR==a+(b*n)' a=0 b=1 inputfile >>outputfile (2 Replies)
Hi,
I have two text files. Need to create a third text file extracting specific data from first two existing files..
Text File 1: Format contains:
SQL*Loader: Release 10.2.0.1.0 - Production on Wed Aug 4 21:06:34 2010
some text ............so on...and somwhere text like:
Record 1:... (1 Reply)
Hi All,
I need to pull the data from a file from 2 set of directories & should be mailed.
I have a code , it is failing for some reason. Do somebody correct me where my script is going wrong.
Directories:
1st Set of Directory /176_PS/Transactions/**/syslog.log
** : prd1
prd2... (2 Replies)
Guys I am having a problem with being able to find missing monitors in a configuration check script I am trying to create for accountability purposes for managing a large number of systems. What I am trying to do is run a script that will look at the raw config data in a file and pull all the pool... (7 Replies)
Hello,
I have a problem which is giving me headache for days, can some please help. Please see code and text fiel below. Please see text in red for the problem I am facing
# Program gets an input x from user
while read line ; do
echo... (4 Replies)
hello,
I have got the following problem that I am hoping someone can help with please.
1. I have got the following text file (below) , the columns data are
'Test Day', 'Board', 'Betting Number'.
TEXT FILE
============================================
1 3 02-01-27-28-29-30
0 1... (1 Reply)