Search Results

Search: Posts Made By: ddrew78
1,971
Posted By ddrew78
You are correct, however, I already attempted...
You are correct, however, I already attempted that and swapped my "if" and "else" conditions, but I always got an error about the "else" line having a syntax error, see code and errors below.

if (...
1,971
Posted By ddrew78
problem with if/while statement
I'm trying to have the script check if a file has data or not, and then process it accordingly. If the file is empty, I want it to return "nothing to do", if not, I want it to process the file line...
2,486
Posted By ddrew78
ok, so I modified the code to what I have below....
ok, so I modified the code to what I have below. The problem is that it no always prints "message here", even if the file is not empty.


system "rm file2";
open(FILE2, ">file2");
...
2,486
Posted By ddrew78
Change output if file is empty
I'm very new to writing scripts, so here is my problem...I have the following code already written (in perl)

system "rm file2";
open(FILE2, ">file2");
open(MYINPUTFILE, "file");
...
1,636
Posted By ddrew78
Thanks to all who helped me on this. After much...
Thanks to all who helped me on this. After much pain I decided to go a different route and instead appended the repeating string to it's previous line. Granted, that resulted in a few extra lines of...
1,636
Posted By ddrew78
Re: Find line before blank
Thanks for the reply. Unfortunately I'm new to this and can't figure out how to implement this into my script. Below is the last two lines of the script to get the file I had above.

system...
1,636
Posted By ddrew78
Re: Find line before blank
summer cherry,

here is what I ended up with in my script:

#!/usr/bin/perl

open $fh,"<","myfile";
open $out,">>","mynewfile";
undef $/;
$str=<$fh>;
print $out...
1,636
Posted By ddrew78
Find line before blank
Hello,

I actually have two issues. First, here is the file the way it is now.

someword someword:1
new-word new-word abcd
someword someword:10
new-word new-word abcd
thisis...
Showing results 1 to 8 of 8

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