Thanks Yoda for the reply but I am getting syntax error with the command provided.Could you please send it again
bash-3.00$ awk '{gsub(/.*\] |".*/,X);NF-=1}1' testing
awk: syntax error near line 1
awk: illegal statement near line 1
Please let me know if you require more information.
Well, more is always better, but i think this will do. You should have told us this at the beginning.
Quote:
Originally Posted by Vinod Chandar
There is nothing specific where we can identify whether the name part is over .
Immediately after the name part the phone device model appears [...]
and after the phone device model you can see device version within apostrophe "" ...
the username will be exactly on the 5th column(I am counting based on the space).
Actually the username is not the fifth but the seventh column if i count correctly. Anyways, i based my own rule on the first "]" character as this seems to be in every line and is easier to match. I suggest you try the following steps out one by one, always feeding the output of the first as input into the next. Examine the resulting intermediate files carefully for each step so that you can find out where something went wrong.
We start with identifying the beginning of the name: as i said, my rule for the beginning of the name is the "]" and i cut away everything up to the first "]" and the following blank:
Now for the names end: we search for a double-quote ('"') and delete from the "word" ("word" here means: some string surrounded by space chars) previous to it (the supposed "Device Model") to the end of the line:
If everything works well (but only after you made sure this is the case!) you can combine both steps into one:
If this results indeed in identifying the name part show you how to correct the spacing and capitalization, but one step after the other.
Hi,
I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database.
For instance:
USER CITY
--------- ----------
A CITY_A
B CITY_B
C ... (2 Replies)
Hi,
I have a script to remove null values from a file. Could any one explain how this is working? :confused:
while read f
do
echo process $f
gawk... (0 Replies)
Hi,
I have a requirement as below which needs to be done viz UNIX shell script
(1) I have to connect to an Oracle database
(2) Exexute "SELECT field_status from table 1" query on one of the tables.
(3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
I wrote a very simple script to calculate the DB connection from an appserver and check the total netstat connection to a particular DB exceed 25 then it will send mail
netstat -a 2> /dev/null | awk '/.*ESTAB/{print $5}' | cut -d. -f1 | uniq -c | awk '{if ($1 > 25)print $2," exceed ",$1;}'
... (1 Reply)
I would like to use the result of a query in another query. How do I redirect/add the output to another variable?
$result = odbc_exec($connect, $query);
while ($row = odbc_fetch_array($result)) {
echo $row,"\n";
}
odbc_close($connect);
?>
This will output hostnames:
host1... (0 Replies)
I just started to learn unix -
need help to write a script to query a logfile and produce the results that
contains a specific word "alarm" for a period from X day to Y day.
I really have no idea how to begin - :(
please help...
____________________________________________________
#... (1 Reply)
I have converted data written on excel sheet in unix through shell & perl prg
now the problem is I want that if starting columns of the xls sheet is Blank than when data is converted into unix then it should appear with this '|' sign. but it appearing like this:
hfgg|tytt|
but I want like... (2 Replies)
Hi,
I have a challenging task,in which i have to find the duplicate files by its name and size,then i need to take anyone of the file.Then i need to open the file and find for more than one pattern and count of that pattern.
Note:These are the samples of two files,but i can have more... (2 Replies)
hi,
how can i do the following.....
i have file containing followig
a k 10000
b c 200000
d e 50
a j 40
how can i list all rows containg last value more than 1000?
and how can i find number of blank rows in the file?
THANKS!
regards
vivek (2 Replies)