Note i am not sure if the code which you gave works as intended as i see the while loop is just doing a count++ only and the remaining commands are outside the loop
If the file is too big this would be an ideal way to do as you are not loading any thing in memory alternatively if the file is very small then you can load the whole file into memory and then access it . In the latter case you will not be required to do a move.
I am having some success with your list method. Only having one issue which I can explain here in a minute. The files needing this sort of operation are not really that big considering the box has 48 gigs of memory. Files might have 100 or less lines of code that need edits. I am curious what an example of writing the new file, deleting the old one(replacing) would look like. Sounds simple enough. Here is my issue:
I have to edit the file names a little for SBU(sensitive but unclassified). Ok! List [37] = "$RM2"; the actual line on 37 is: Yadda="$RWHOIS $LM $RM"
I need $RM2 somewhere within the double quotations. Can't seem to print this one but everything else goes into the file.. Of course $RM2 is the most important its the PID. I could get by without a description showing correctly but the PID no way! Mumford your the man no matter what others on the forum say about you. Jk
Last edited by Scott; 12-16-2009 at 01:10 PM..
Reason: Please use code tags
...It prints on line 110 / 210 the following: SCALAR (0x6C1345) <--- something like this.
I don't know what your program looks like now, so I shall explain that "SCALAR(0x6C1345)" thingy. My hunch is that you tried to assign a scalar variable to another with the backslash ("\") prefixed to it and forgot the double quotes.
The "SCALAR(0x6C1345)" is not an error message. It's the type of value pointed to by a reference, and its memory address. If you are familiar with the concept of a pointer in C, then you will be delighted to note that a reference is its (loose) equivalent in Perl.
Given below is a short one-liner where I create a Perl scalar variable $x, then create a reference to it, and then print the reference:
I hope the example above gives you an idea of what might be wrong in your code. You'll have to walk through it and figure out where you are doing something similar i.e. trying to print a reference, rather than a scalar. Otherwise, if you post your program here then we can have a look at it and try to find it for you.
Hi,
I need to create a test text file with the special characters \342\200\223 in it and to be able to use sed maybe to delete them
I tried doing it using vi by pressing CTRL-V and then typing 342 but it does not work. After pressing CTRL-V and typing 342 it seems to just insert the numbers... (1 Reply)
Hi,
I've 2 queries.
I need to list files which doesn't contain a particular text in the content. For example say, I need to list files which doesn't contain string "abc" from all files ending with *.bad. How can I do that?
Also, I want to display number of lines in a file which has atleast... (2 Replies)
Hi
I have a file and need to extract lines starting with "grep ^"
I tried with quotes single/double before/after but no luck.
suggestion pls, thanks! (2 Replies)
Hi All,
My source file contains special characters(Latin characters).I need to fetch only the lines which contains the special characters. The problem is i don't know which all latin/special characters can come in the source.
Is there anyway to extract the lines which contain letters other... (3 Replies)
Hi,
I have a file which has numerous lines and some of the lines having special characters in it. i want to grep the lines which are having special characters.
say,
one line looks like - %*()$#@"", | acbd
antoher line looks like ***##^%! | efcg
so these kind of lines are present... (5 Replies)
I am attempting to insert multiple lines of text into a specific place in a text file based on the lines above or below it.
For example, Here is a portion of a zone file.
IN NS ns1.domain.tld.
IN NS ns2.domain.tld.
IN ... (2 Replies)
Hi All,
i am trying to remove all special charecters().,/\~!@#%^$*&^_- and others from a tab delimited file.
I am using the following code.
while read LINE
do
echo $LINE | tr -d '=;:`"<>,./?!@#$%^&(){}'|tr -d "-"|tr -d "'" | tr -d "_"
done < trial.txt > output.txt
Problem
... (10 Replies)
Suppose content of my first file:
first line
second line
third line
How can i insert text between "first line" & "second Iline"
Any help?????/ (7 Replies)
Hi ,
i export the crontab in a file (i've no root right) and i would add lines from a file at a special place and rewrite the output in an another file.
the special place is as this :
45 04 * * * /home/toto.sh > /dev/null 2>&1
#
so i would search for toto.sh and insert the lines , the... (5 Replies)