Search Results

Search: Posts Made By: santoshdrkr
4,158
Posted By Don Cragun
OK. So this is a completely different...
OK.

So this is a completely different problem than what you described in the 1st post in this thread. All of the lines you showed us in that post:
01~12345~Y~YES~aaaaa~can...
4,158
Posted By Don Cragun
No, you are not. This grep command will only...
No, you are not. This grep command will only match lines that contain the exact string ~Y or YES~. If you want to match any line that contains ~Y, ~y, YES~, YEs~, YeS~, Yes~, yES~, yEs~, yeS~, or...
4,158
Posted By Don Cragun
You have shown us code that adds data to an...
You have shown us code that adds data to an existing file (with no indication of what was in the file to begin with). You have shown us code that would generate syntax errors.

Please wait until...
4,158
Posted By Don Cragun
Please show us your code. If you had used what...
Please show us your code. If you had used what Chubler_XL suggested in message #8 in this thread, "Junk" should always be zero. The math from his suggestion when expanded to what you're asking for...
1,872
Posted By Don Cragun
That depends on what you are trying to do. ...
That depends on what you are trying to do.

If you are trying to run the commands named by stripping everything following the 1st period on every line found until awk hits EOF while reading...
9,751
Posted By SriniShoo
What have u tried?
What have u tried?
9,751
Posted By vbe
That would be Excel macros, and so MSwindows, no...
That would be Excel macros, and so MSwindows, no more UNIX...
Therefore wrong forum, moving to windows...
9,751
Posted By gandolf989
In the past when I wanted to create a spreadsheet...
In the past when I wanted to create a spreadsheet based on something that runs in Unix/Linux I create a shell script that runs on a server, which creates a comma delimeted file with the .csv...
9,751
Posted By rbatte1
Hello santoshdrkr, I have a few to questions...
Hello santoshdrkr,

I have a few to questions pose in response first:-
Is this homework/assignment? There are specific forums for these.
What have you tried so far?
What output/errors do you...
1,000
Posted By Don Cragun
I am reading the requirements very differently...
I am reading the requirements very differently than MadeInGermany.

Please show us some sample input and the output you expect to get from that input.
4,158
Posted By Chubler_XL
It could look like this: awk ' /~YES~/...
It could look like this:

awk '
/~YES~/ {Y++}
/~NO~/{N++}
END{
print "Total Records : " NR
print "YES : " Y
print "NO : " N
print "No Response : " NR - Y - N
}'...
1,000
Posted By MadeInGermany
If "in front of" means "following" (as stated in...
If "in front of" means "following" (as stated in the thread title):
awk -F'~' '($1=="99") { sum+=$2 } END { print sum+0 }' file
Looking for 99 left from a ~ and summing up the value right from the...
4,158
Posted By Chubler_XL
Yes 2nd loop is counting records with ~YES~ and...
Yes 2nd loop is counting records with ~YES~ and ~NO~

I left a line from the previous solution in that can be removed:

while read file
do
printf "$file\n\t99: %s\n" $(sed -n '$s/^99~//p'...
4,158
Posted By Chubler_XL
Yes but it's less efficient as filename.txt and...
Yes but it's less efficient as filename.txt and the individual files are read twice:

while read file
do
printf "$file\n\t99: %s\n" $(sed -n '$s/^99~//p' $file)
done < filename.txt

printf...
4,158
Posted By Chubler_XL
Not sure what you want your output to look like...
Not sure what you want your output to look like but this might get you started:

while read file
do
awk -F~ '
{if($1=="99")T=$2; else T=x}
/~YES~/{Y++}
/~NO~/{N++}
END{
...
Showing results 1 to 15 of 15

 
All times are GMT -4. The time now is 04:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy