Win a copy of Rust Web Development this week in the Other Languages forum!

Kurosaki Ichigo

Greenhorn
+ Follow
since Dec 31, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kurosaki Ichigo

amol Bhandwale wrote:Hi All,
And want to extract the string between this segment ~B2**ETRV**Amol990**PP~B2A*04~ ie Amol990

i tried with

awk '/ETRV/, /PP~B2A/ ' filename



this is one way you can do it.

set the record separator to PP~B2A. Then set the field separator to ETRV. The last field will be what you want.
11 years ago

James Sabre wrote:I would use probably Perl not awk -


awk can do the job just as well, with regards to file parsing, sometimes even better and faster than Perl.
11 years ago
i am not sure why, but why can't you use the Scanner?

11 years ago

Dhivya rajagopal wrote:
is shown. can you please tell me the reason


you specified that you want to take in an argument using arg[0], so when you run the program, you must input an argument. do it from the command line, or setup your Eclipse environment to run with an argument. (but i suggest not using an IDE when learning how to program)
11 years ago
put a print statement like this,


and see the result. if you don't quote your asterix "*" when you pass in your arguments, it will do a shell expansion.
so quote your "*" when you pass in as argument
11 years ago
@Campbell, the title does not say "You are not allowed to post answers....", so its not fair to just edit my post. Also, giving them code does not mean that they won't be doing their own code analysis and understanding. Don't generalize. I don't give any comments, in the hope that they will have the decency to find out for themselves why and what the code does. If they don't understand after trying to find out for themselves, they can ask and I will kindly explain. Besides, no teachers/schools are stupid enough to pass students that hand in code without explanation or comments. haven't you heard of learning by example?
11 years ago
...
[MG]Edited out ready made solution
11 years ago

Cheryl Scodario wrote:Hi, I am pretty bad at reading nested loops. The following code is for constructing triangle rows.


source: textbook Big Java.

If someone can walk me step by step, it would be very helpful because I will have a better idea of how to read/code nested loops in general! Thanks a lot!



I would suggest putting in your usual braces , even if its one line.

To read nested for loop as above, say "width" is 3 for simplicity


11 years ago

nirjari patel wrote:
How to get the output from file ?


you use a while loop and try/catch
11 years ago