09-05-2006
Quote:
Originally Posted by hkhan12
Hi Unix Experts,
I like to add the following multiple lines in an existing file:
CHANNELS:
MaxChannels=600
MaxActiveChannels=600
MaxInitiators=22
I would be highly appreciated if somebody can shed some light on it.
Thank you in advance!!!
Khan
Have you any experience in shell scripting?
Anyway, to add those lines to files, you can use cat and the >>
cat existing_file >> some_file
provided your existing_file contains only the lines you want to add.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi guys,
Please help me if u have some solution.
I have a file with three columns separated by ':' -
INPUT_FILE
C416722_2 : calin Dirigent : Dirigent
AC4174_6 : Jac : cal_co
TC4260_5 : [no : lin kite
BC426302_1 : [no : calin Dirigent lin
JC426540_3 : lin Pymo_bin : calin
TC428_3 : no7... (4 Replies)
Discussion started by: sam_2921
4 Replies
2. Shell Programming and Scripting
Hi ,
I need some inputs on how to open a file (file.txt) and parse the text example aaa of the file and bbb of the file and add the text zzzz once i parse (aaa and bbb) and followed by the remaining of the text as it is in the file using perl programming.
Thanks in advance (3 Replies)
Discussion started by: madhul2002
3 Replies
3. UNIX for Dummies Questions & Answers
i have a file called motors with 3 columns separated with tabs eg:
car make reg
i want to create a executable file that will add a line with data eg:
car make reg
benz s600 t35778
can you please show me how to do this? (7 Replies)
Discussion started by: fletcher
7 Replies
4. Solaris
Pre: no gpasswd/adduser
there is just usermod can be used, also there is no -a option for usermod.
How should I add a user into a group? (4 Replies)
Discussion started by: a2156z
4 Replies
5. Shell Programming and Scripting
hey guys,
I tried searching but most 'search and replace' questions are related to one liners.
Say I have a file to be replaced that has the following:
$ cat testing.txt
TESTING
AAA
BBB
CCC
DDD
EEE
FFF
GGG
HHH
ENDTESTING
This is the input file: (3 Replies)
Discussion started by: DeuceLee
3 Replies
6. Ubuntu
Hi All
I need to add a column on my existing data file. I know similar posts are there but none of them were meeting my requirement. My input is
1.20 3.44 4.88
5.11 4.99 3.22
1.89 3.89 2.90
Desired output
1 1.20 3.44 4.88
2 5.11 4.99 3.22
3 1.89 3.89 2.90
I will... (2 Replies)
Discussion started by: mahbub03
2 Replies
7. Shell Programming and Scripting
Input File 1
cat S1.txt
MI0043 2731 miR-1
Input File 2
cat S4.txt
MI006 310 CiR-1
MI057 10 CiR-24
MI750 5 CiR-24
Desired Output File 1
cat S1.txt.out
MI0043 2731 miR-1 S1.txt
Desired Output File 2
cat S4.txt.out
MI006 310 CiR-1 S4.txt (3 Replies)
Discussion started by: perl_beginner
3 Replies
8. Shell Programming and Scripting
GM,
I have an issue at work, which requires a simple solution. But, after multiple attempts, I have not been able to hit on the code needed.
I am assuming that sed, awk or even perl could do what I need.
I have an application that adds extra blank page feeds, for multiple reports, when... (7 Replies)
Discussion started by: jxfish2
7 Replies
9. Shell Programming and Scripting
Hello,
I have a .xlsx file with 11 worksheets and I need to insert the contents of a text file (tab delim, roughly 30 columns with 1000 rows) from Row 3 onwards on the 2nd sheet. I have my code which can insert values into existing sheet but I am unable to write/import the contents of a text... (0 Replies)
Discussion started by: nans
0 Replies
10. Shell Programming and Scripting
Hello,
I have a .xlsx file with 11 worksheets and I need to insert the contents of a text file (tab delim, roughly 30 columns with 1000 rows) from Row 3 onwards on the 2nd sheet. I have my code which can insert values into existing sheet but I am unable to write/import the contents of a text... (1 Reply)
Discussion started by: nans
1 Replies
LEARN ABOUT DEBIAN
test::mocktime
Test::MockTime(3pm) User Contributed Perl Documentation Test::MockTime(3pm)
NAME
Test::MockTime - Replaces actual time with simulated time
SYNOPSIS
use Test::MockTime qw( :all );
set_relative_time(-600);
# do some tests depending on time increasing from 600 seconds ago
set_absolute_time(0);
# do some more tests depending on time starting from the epoch
# epoch may vary according to platform. see perlport.
set_fixed_time(CORE::time());
# do some more tests depending on time staying at the current actual time
set_absolute_time('1970-01-01T00:00:00Z');
# do some tests depending on time starting at Unix epoch time
set_fixed_time('01/01/1970 00:00:00', '%m/%d/%Y %H:%M:%S');
# do some tests depending on time staying at the Unix epoch time
restore_time();
# resume normal service
DESCRIPTION
This module was created to enable test suites to test code at specific points in time. Specifically it overrides localtime, gmtime and time
at compile time and then relies on the user supplying a mock time via set_relative_time, set_absolute_time or set_fixed_time to alter
future calls to gmtime,time or localtime.
Functions
set_absolute_time
If given a single, numeric argument, the argument is an absolute time (for example, if 0 is supplied, the absolute time will be the
epoch), and calculates the offset to allow subsequent calls to time, gmtime and localtime to reflect this.
for example, in the following code
Time::Mock::set_absolute_time(0);
my ($start) = time;
sleep 2;
my ($end) = time;
The $end variable should contain 2 seconds past the epoch;
If given two arguments, the first argument is taken to be an absolute time in some string format (for example, "01/01/1970 00:00:00").
The second argument is taken to be a "strptime" format string (for example, "%m/%d/%Y %H:%M:%S"). If a single argument is given, but
that argument is not numeric, a "strptime" format string of "%Y-%m-%dT%H:%M:%SZ" is assumed.
for example, in the following code
Time::Mock::set_absolute_time('1970-01-01T00:00:00Z');
my ($start) = time;
sleep 2;
my ($end) = time;
The $end variable should contain 2 seconds past the Unix epoch;
set_relative_time($relative)
takes as an argument an relative value from current time (for example, if -10 is supplied, current time be converted to actual machine
time - 10 seconds) and calculates the offset to allow subsequent calls to time,gmtime and localtime to reflect this.
for example, in the following code
my ($start) = time;
Time::Mock::set_relative_time(-600);
sleep 600;
my ($end) = time;
The $end variable should contain either the same or very similar values to the $start variable.
set_fixed_time
If given a single, numeric argument, the argument is an absolute time (for example, if 0 is supplied, the absolute time will be the
epoch). All subsequent calls to gmtime, localtime and time will return this value.
for example, in the following code
Time::Mock::set_fixed_time(time)
my ($start) = time;
sleep 3;
my ($end) = time;
the $end variable and the $start variable will contain the same results
If given two arguments, the first argument is taken to be an absolute time in some string format (for example, "01/01/1970 00:00:00").
The second argument is taken to be a "strptime" format string (for example, "%m/%d/%Y %H:%M:%S"). If a single argument is given, but
that argument is not numeric, a "strptime" format string of "%Y-%m-%dT%H:%M:%SZ" is assumed.
restore()
restore the default time handling values. "restore_time" is an alias. When exported with the 'all' tag, this subroutine is exported as
"restore_time".
AUTHOR
David Dick <ddick@cpan.org>
PREREQUISITES
Time::Piece 1.08 or greater
BUGS
Probably.
COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
ACKNOWLEDGEMENTS
Thanks to a use.perl.org journal entry <http://use.perl.org/~geoff/journal/20660> by Geoffrey Young.
perl v5.10.0 2008-06-29 Test::MockTime(3pm)