General :: Append # Begining File In Perl
Nov 28, 2010Can you please let me know how can i append # in the begining of each line Based on a a search string lile /^8282##8282/gc
View 1 RepliesCan you please let me know how can i append # in the begining of each line Based on a a search string lile /^8282##8282/gc
View 1 Replieswhere I'm trying to demonstrate the file locking concept through Perl/CGI.Here is the script which I tried.
Code:
#!/usr/bin/perl -w
use strict;
use warnings;
print "Content-type: text/html
[Code].....
I have a requirement like this..this just a sample script...
Code:
when i run this scipt...
Code:
Code:
It is appended in the same line...
I want it to be added to the next line.....
I want to do this by explitly using the filehandles in perl....and not with redirection operators in shell.
I know similar questions have been asked before but I cannot seem to get it to work.I have a file file.something.nhMMYY that i need to ftp (MMYY being Month and Year)I want to add something into the script to auto-magically insert the MMYY.
View 8 Replies View RelatedI wanted to be as clear as possible. I have to add hundreds of new servers to hundreds of configuration files in Nagios. Here is a sample structure:
servers.txt has:
SERVER3
SERVER4
[code]....
Using sed, I am trying to append four commas ',,,,' at the end of lines containing the pattern 'Response' in a text file with lines such as these:
6,Pulse,50,254968,14886,NA,,,,
7,Picture,8,265157,0,1,15045,2,0,15000
7,Response,1,271553,6396,1
7,Pulse,50,274969,9812,NA,,,,
8,Picture,1,290232,0,1,15045,2,0,15000
8,Pulse,50,294969,4737,NA,,,,
[Code].....
Code:
cat ${SOURCE}/{start,universal,index,end}.txt > ${SERVER}/index.html
cat ${SOURCE}/{start,universal,02042010,end}.txt > ${SERVER}/02042010.html
[code]....
I have a file, say abc.txt, whit some text lines.The I have a second file, say 123.txt where at a certain point one can read "WORD".I would like to append the whole content of abc.txt (as it appears in abc.txt) in the line after "WORD".
View 1 Replies View RelatedI have two files list1.cfg and list2.cfg both files contains differentrecords details like
List1.cfg
NAME1:25:C:NAME LINE1:
NAME2:25:C:NAME LINE2:
CITY:25:C:City:
[code]....
Now I want to append contents list2.cfg to list1.cfg(It ispposible using cat list2.cfg >>list1.cfg) but I want to check if content of (record) in list2.cfg is present in list1.cfg then dont append it otherwise append it.
I am using openSUSE 10.3.When I install software from tarball then to record time required I send output of date to beg.txt(when installation begins) and end.txt (when installation finishes).How can I append output of date to a file so I don't need two files?
View 4 Replies View RelatedIs there a way to specify append only permissions for a file?
View 2 Replies View RelatedI want to append some text to the file, files are mostly big, more then 100 mb. I found the cat command, so I can create a new txt file and then append it to the original file with it. Two questions:
1. Can I append text to the file instead of creating the new file and then appending it to the original file? eg:
Code:
cat file.avi "some text" > newfile.avi
2. cat takes several seconds to execute the merging files together, it seems that it is reading the original file first, is there a way skip the reading and just append the file?
Sudo echo fuse >> /etc/modules
Any idea why that'd yield a "bash: /etc/modules: Permission denied" error? Here's what "stat /etc/modules" says code...
Say I have a text file like:
Code:
1
3
4
How would I use ksh to put the number '2' into the second line of that file?Okay it's not bash, it's ksh because this computer is OpenBSD
I am trying to append text to the beginning of a file. This is what I have so far.
Code:
date_default_timezone_set('America/Chicago');
$date=date("m-d-Y g:i:s a");
[code]....
How do you append text to an entry in an existing file? For example, lets say I have a file called "env.logon" in /home/myself/bin that contains the following text:
PATH=/bin:/sbin If I wanted to add, via command line, ":/usr/bin:/usr/sbin" to the PATH= and I
used the "echo" command (echo "PATH=:/usr/bin:/usr/sbin) it would create a second entry and my file would look like:
PATH=/bin:/sbin
PATH=:/usr/bin:/usr/sbin
What I want is for it to look like:
PATH=/bin:/sbin:/usr/bin:/usr/sbin
Is there a way to get this result via command line?
I want to append data to a file where immutable flag is set..So i have tried this command chattr +a file_name to append data..But i am unable to append the data..
View 7 Replies View RelatedI am thinking of appending something to each line in a text file with Java. I prefer not write a new file with content appended from the old one.That 'something' would probably be Time Stamp when the file is created (which is same for each line).I am not sure Java provide some easy way for it or not
View 3 Replies View RelatedSo I have file which looks something like this:
cat .opera/operaprefs.ini
Code:
[User Prefs]
Language Files Directory=
[code]...
I am witing a file upload program in perl where i need to upload a wav or a gsm file and save it as a gsm file.How can i make sure that the uploaded file is a wav or a gsm sound file and not an executable malicious script or something.
View 2 Replies View Relatedi want to get the latest file name from a directory, how can i do with perl script. In other words, how to sort the contents of a folder on the basis of time and capture the latest file using perl script,
View 6 Replies View RelatedIf I need to append a set (or sets) of data to a file(or files) on remote hosts what is the best mechanism by which to do that? My first thought was ssh but the command syntax to append to a remote file isn't clear to me. Can anyone point me in the right direction here?
View 4 Replies View Relatedon creating a new perl script which replace IP address from the text file. eg. If in a file, we found any word like 11.222.333.44 then it has to be replaced to XX.XXX.333.44
View 8 Replies View RelatedI'm doing an assignment for school, and while we have not yet learned regular expressions, my teacher would like us to use AWK to append text to certain lines in a file. What we've had to do is creating a listing of all links and directories in the /etc folder and place them in a text file. From this, we were to cut the first field (Permissions) and the ninth field (filename) and create another text file. Now the part that I'm struggling with is this and I'm not sure if I should be using sed or awk. We're supposed to ADD the text "DIR" to the beginning of any line that is a directory, and "LNK" to any that is a link, like so:
DIRdrwxr-xr-x redhat-lsb
DIRdrwxr-xr-x rhgb
LNKlrwxrwxrwx rnDIRc.key
DIRdrwxr-xr-x rpm
Obviously, I realize that the first character in the permissions denotes what sort of file it is, hence when I created my text file I used
ls -l | grep "^d" > file.txt
and
ls -l | grep "^l" >> file.txt
I'd like to learn how to properly do this, but struggling through pages on the internet hasn't been helping, nor has the --help command. Therefore, while I would like the answer, I'd also like to know what the heck I'm doing For example, I know I could delete lines with regex using d/[STUFF I WANT TO DELETE]/g (To get rid of all occurences) and I can substitute using s/foo/bar But I'm unaware of anyway to ADD text upon certain occurences, let alone two different circumstances.
the query is ||| how to append a char | string |||
#!/bin/bash
echo -n "one""two""three"
#END
above method is working well but below method is not working ?
#!/bin/bash
one=one
two=two
three=three
echo -n $one$two$three
#END
i just want to create a folder with current time.
For example.
foldername_09042010 How do i modify mkdir or write script to do this?
I am looking for some source package which will convert plain text file to html file without using perl.
I mainly need to do this on an ARM platform, so if I get sources I can cross compile it.
I have script that I'm working on that updates a username in all the files that are called blah.inc for my framework. since i host a bunch of these web apps i need to do it to all of them. so I need to figure out how to update these files automagically with out me watching it to call vim every time. heres what I have so far
Code:
This finds the files but now i need to figure out how to do s/bob/fred/g on those files.
Greetings, I want to automatically append flags to certain commands. For example, when I type:
ls
at the prompt, I want the
-la
flags automatically appended without me having to type:
ls -la
we have centos and a win2k8 server. Our pos system is on the centos server. I created a HOST (A) record on win2k8. so users don't have to remember the ip address of the centos server.so i created a friendly name like URL... and the POS web page will be loaded.but my questions is it possible to configure the centos to automatically append the port number if the user type URL... will be auto added at the end of it.
View 3 Replies View Related