10-13-2008
help with insert line into file
hi..i wanted to know is there any way to take input from the user and copy that a particular line number in a particular file
for eg . i wanted to create acl in squid at line number 2400 in squid.conf file
so the user gives an input like acl inetblock src 192.168.0.0/255.255.0.0
so is there any way i can append this line to line number 2400
will i have to use awk or sed or regex ..i dont know what to use ..
i am a noob in linux so was looking for help
![Smilie Smilie](https://www.unix.com/images/smilies/smile.gif)
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hello,
I need to insert a line (like a header) as the first line of a very huge file (about 3 ml rows). I am able to do it with sed, but redirecting the output and creating a new file takes quite some time. I was wondering if there was a more efficient way of doing it?
Any help would be... (3 Replies)
Discussion started by: shriek
3 Replies
2. Shell Programming and Scripting
Hello guys,
Need to know how to insert a line at top of the file, without using temp files.
Can we do it on the fly?
Regards,
Rishi (7 Replies)
Discussion started by: RishiPahuja
7 Replies
3. Shell Programming and Scripting
Hi,
My File 'temp.txt' contents are like this.
<Managers>
Mng={{FIL|FAVEI.mng|111}|15.000000|17.000000|17.000000|
Mng={{FIL|FAPSV.mng|222}|3.000000|0.000000|0.000000|0.000000|
Mng={{FIL|FAVIF.mng|333}|8.000000|8.000000|8.000000|8.000000|... (3 Replies)
Discussion started by: vinay123
3 Replies
4. Shell Programming and Scripting
Hi
I have a file with numbers like this :
123
456
6798
9073233
12
8644
Now, I need to insert parentheses to each and every line like below :
(123)
(456)
(6798)
(9073233)
(12)
(8644)
can anyone tell me a solution? (8 Replies)
Discussion started by: sudharsan23
8 Replies
5. Shell Programming and Scripting
I have a file with data as below :
Heading 1
-------------
Heading 1 data1
Heading 1 data2
Heading 1 data3
Heading 1 data4
Heading 2
-------------
Heading 2 data1
Heading 2 data2
Heading 2 data3
Heading 2 data4
Heading 3
-------------
Heading 3 data1
Heading 3 data2
Heading 3... (2 Replies)
Discussion started by: yoursdivu
2 Replies
6. Programming
how to insert a line of text that is next to the current line(file pointer pointing to) in the file ?? :wall:
ex:
suppose a file named 'Sample' has the following content in it.
this is to
give clear idea about
the problem
if file pointer is pointing to the first line then i want to... (3 Replies)
Discussion started by: kavitha rao
3 Replies
7. Shell Programming and Scripting
Hi,
I need to insert a new line containing the string "QUERY" above every 5 lines.
The below piece of code inserts a new line after every 5th line
awk '{print $0} !(NR%5) {print "QUERY"}'
sed 'n;n;n;n;G;' --> I do not know how to give "QUERY" string here
But I need to insert it before... (4 Replies)
Discussion started by: royalibrahim
4 Replies
8. Shell Programming and Scripting
Hi all,
I have a huge file(size more that 5GB).
I want to do some manupulation with the records and write to another file.
As the size of the file is huge and there is a space constraint in that directory, I want to delete that record from first file after writing it in to second file.... (3 Replies)
Discussion started by: gani_85
3 Replies
9. Shell Programming and Scripting
I have a test file that I want to read and insert only certain lines into the
the table based on a filter.
1. Rread the log file 12 Hours back Getdate() -12 Hours
2. Extract the following information on for lines that say "DUMP is
complete"
A. Date
B. Database Name
C.... (2 Replies)
Discussion started by: JolietJake
2 Replies
10. UNIX for Beginners Questions & Answers
Hi All,
I am using UNix Sun OS sun4u sparc SUNW,SPARC-Enterprise
My intention is to insert a line of text after 13th line of every file inside a particular directory.
While trying to do it for a single file , i am using sed
sed '3 i this is the 4th line' filename
sed: command garbled: 3... (5 Replies)
Discussion started by: gotamp
5 Replies
LEARN ABOUT DEBIAN
pbuilder-uml.conf
pbuilder-uml.conf(5) pbuilder pbuilder-uml.conf(5)
NAME
pbuilder-uml.conf - configuration file for user-mode-linux port of pbuilder
DESCRIPTION
/etc/pbuilder/pbuilder-uml.conf contains default values used in pbuilder-user-mode-linux program invocation.
FORMAT
MY_ETH0=tuntap,,,192.168.0.2
Configures ethernet setting used for booting linux. See how rootstrap boots your system, and copy that.
Specify --eth0=slirp,12345,/usr/bin/slirp-fullbolt to use the slirp connection.
UML_IP=192.168.0.3
IP address to use for guest OS.
This can be set to dhcp for obtaining IP address through DHCP.
UML_NETMASK=255.255.255.0
Guest OS netmask
UML_NETWORK=192.168.0.0
Guest OS network
UML_BROADCAST=255.255.255.255
Guest OS broadcast
UML_GATEWAY=192.168.0.1
Guest OS gateway
PBUILDER_UML_IMAGE=${HOME}/uml-image
Guest OS file system image.
UML_MOUNT_TMPFS=no
Whether to mount tmpfs inside the guest image. This is probably mostly useless.
BUILDPLACE=${HOME}/tmp/
The location which build will take place. pbuilder-user-mode-linux will place temporary COW files to there. The user running UML
needs to be able to access that directory.
UML_MEM=128
The amount of memory allowed for UML. Give more value to here.
UML_HOSTNAME=uml-host
The hostname for the UML.
The hostname should be available in /etc/hosts so that hostname -f will be able to return the FQDN.
UML_BUILDRESULT=/directory/of/build/result
The directory where build result of pbuilder-user-mode-linux is stored.
ROOTSTRAP_IMAGESIZE=size-in-megabytes
The size, in MB, of the disk iamge to create. Defaults to 1000.
NOTES
It is advised to set APTCACHEHARDLINK to no in ~/.pbuilderrc. see pbuilderrc(5) for details.
AUTHOR
Initial coding, and main maintenance is done by Junichi Uekawa <dancer@debian.org>.
The homepage is available at http://pbuilder.alioth.debian.org
FILES
/etc/pbuilder/pbuilder-uml.conf, ${HOME}/.pbuilderrc
SEE ALSO
/usr/share/doc/pbuilder/pbuilder-doc.html, pbuilder-user-mode-linux(1), pbuilder(8), pbuilderrc(5), pdebuild(1)
Debian 2003 Jan 8 pbuilder-uml.conf(5)