Tagged Questions
1
vote
2answers
39 views
How to parse fields out of a text file and write them to another file
I have executed a database command and have generated an output file of the results.
Each field name starts with dbt_xxxxxx
Each field value is the value after the equal sign.
how can I parse the file ...
3
votes
1answer
90 views
merging files and getting column values based on id field
bash-3.2$ cat sample.log sample.log.1 sample.log.2
ID COL1 COL2 COL4
1 col1 col2 col4
2 c1 c2 c4
3 co1 co2 co4
ID COL3 COL1
1 col3 col1
2 c3 c1
3 co3 co1
ID COL1 COL2 COL3
1 col1 ...
1
vote
2answers
96 views
$2 (field reference) in awk BEGIN is not working
In the following snippet, $2 in awk is returning empty. What am I doing wrong? I am trying to find the difference between MAX and MIN.
#!/bin/ksh
if [ $# -ne 1 ]; then
echo "Usage: sh ...
3
votes
1answer
104 views
Efficient way of comparing in awk
#!/bin/awk
BEGIN {
while(getline var < compareTo > 0)
{
orderIds[var]=var;
}
}
{
if(orderIds[$0] == "")
{
print $0;
...
1
vote
3answers
159 views
To list out duplicate filenames in a listing?
bash-3.00$ cat f.txt
-rw-r--r-- 1 mukesh other 102 Nov 5 18:32 f1.txt
-rw-r--r-- 1 mukesh other 19 Nov 5 18:32 f2.txt
-rw-r--r-- 1 mukesh other 204 Nov 5 18:32 ...
3
votes
1answer
106 views
Help improving my AWK skills
This program works as I intended but I feel like I used some clumsy methods to get the out put I desired(especially with my use of print commands and variable declarations)
Could some one improve ...