Sponsored Content
Full Discussion: Adding new line to file
Top Forums Shell Programming and Scripting Adding new line to file Post 302903170 by lazy_bear on Sunday 25th of May 2014 09:35:31 PM
Old 05-25-2014
I want to show you what you're demanding, but I really can't. In my company, pc for working can not access to internet, I have to use another pc which allowed to access internet to go here, and working pc and internet pc are not connected, so there is no way I can show you the infos you want, please pardon me for this.
As I said, my job is rarely relate with scripts. I only know a little C-shell via some scripts for my work verification, know nothing about awk and Perl is just a little since 2 days ago. I use Perl because it can output an excel file (as my colleague told me).

I will try to describe my problem again. I have 2 file which contain lines with these info
Code:
coordinate_x coordinate_y variable_name value1 value2 value3

I need to compare which line in 1st file has same variable_name with 2nd file, which doesn't, then print to excel file one sheet for all same variable_name, another sheet for different variable_name.
Currently, I'm stuck in how to compare them quicker, because my script take terrible long running time for compare them. I'm finding another way to overcome my problem.
Please kindly have some suggestion.

Thank you so much in advance Smilie.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Adding Text To each line of a file

How would I add text to the beginning of each line in a text file in a script right after the file is created from another text file. (4 Replies)
Discussion started by: cubs0729
4 Replies

2. Shell Programming and Scripting

adding a line to a file

I want to add a line at the beginning and at the end of a file.. e.g. echo "at the beginning.." > tmp_file && cat file >> tmp_file && echo "last line" >> tmp_file && mv tmp_file file is there a nice way for doing that?? Thx (2 Replies)
Discussion started by: andy2000
2 Replies

3. Shell Programming and Scripting

Adding a line to a file

Hi guys, How to add a line before a specific line (identified with the starting work ex: xxx) of a file and write it back to the same file? Thanks (12 Replies)
Discussion started by: mwrg
12 Replies

4. Shell Programming and Scripting

Adding filename to each line of the file

Hi, I am a relative new bee in scripting. I need to develop a script such that the code would iterate through each file in a source directory and append every line of the file with '|' and the corresponding file filename. eg INPUT file IF927_1.dat - H|abc... (4 Replies)
Discussion started by: scripting_newbe
4 Replies

5. Shell Programming and Scripting

adding a line to file

i am writing a script which will let user to input a line. i m not sure how do i add this line to the end of a txt file ? (8 Replies)
Discussion started by: 76455
8 Replies

6. Shell Programming and Scripting

Adding data in a file on same line

Hi, I have one file a.txt ,the contents of the file is A B C D E F and I have another file b.txt, the contents of the file is 1 2 3 4 5 6 now when I am using this command cat a.txt b.txt > c.txtI am getting the output as A B C D E F 1 2 3 4 5 6 but i need the output... (2 Replies)
Discussion started by: prarat
2 Replies

7. Shell Programming and Scripting

Adding New empty line in a file

Hi, I am new to Sed /awk commands. using that i want to add new empty line after every line in a file by leaving first three lines. So, can any one help me out how to achieve this. Example: --------- Input Filename: file1.txt Input Data: --------Report-------- Date:20-10-03... (4 Replies)
Discussion started by: G.K.K
4 Replies

8. Shell Programming and Scripting

adding a line to a text file

I have a tab delimited text file, id name distance 1 3325167 0.334561754018 2 3290488 0.389444269458 3 3288794 0.392312701782 4 3347602 0.392532202097 5 3295355 0.394394169485 I need to add a line after the header line. The first and third field of... (3 Replies)
Discussion started by: LMHmedchem
3 Replies

9. Shell Programming and Scripting

Adding tab/new line at the end of each line of a file

Hello Everyone, I need a help from experts of this community regarding one of the issue that I am facing with shell scripting. My requirement is to append char's at the end of each line of a file. The char that will be appended is variable and will be passed through command line. The... (20 Replies)
Discussion started by: Sourav Das
20 Replies

10. Shell Programming and Scripting

Adding line in a file using info from previous line

I have a shell script that looks something like the following: mysql -uroot db1 < db1.sql mysql -uroot db2 < db2.sql mysql -uroot db3 < db3.sql mysql -uroot db4 < db4.sql .... different db names in more than 160 lines. I want to run this script with nohup and have a status later. So,... (6 Replies)
Discussion started by: MKH
6 Replies
PPPCTL(8)						    BSD System Manager's Manual 						 PPPCTL(8)

NAME
pppctl -- PPP control program SYNOPSIS
pppctl [-v] [-t n] [-p passwd] [host:]Port | LocalSocket [command[;command]...] DESCRIPTION
This utility provides command line control of the ppp(8) daemon. Its primary use is to facilitate simple scripts that control a running dae- mon. The pppctl utility is passed at least one argument, specifying the socket on which ppp is listening. Refer to the 'set server' command of ppp for details. If the socket contains a leading '/', it is taken as an AF_LOCAL socket. If it contains a colon, it is treated as a host:port pair, otherwise it is treated as a TCP port specification on the local machine (127.0.0.1). Both the host and port may be speci- fied numerically if you wish to avoid a DNS lookup or do not have an entry for the given port in /etc/services. All remaining arguments are concatenated to form the command(s) that will be sent to the ppp daemon. If any semi-colon characters are found, they are treated as command delimiters, allowing more than one command in a given 'session'. For example: pppctl 3000 set timeout 300; show timeout Do not forget to escape or quote the ';' as it is a special character for most shells. If no command arguments are given, pppctl enters interactive mode, where commands are read from standard input. When reading commands, the editline(3) library is used, allowing command-line editing (with editrc(5) defining editing behaviour). The history size defaults to 20 lines. The following command line options are available: -v Display all data sent to and received from the ppp daemon. Normally, pppctl displays only non-prompt lines received. This option is ignored in interactive mode. -t n Use a timeout of n instead of the default 2 seconds when connecting. This may be required if you wish to control a daemon over a slow (or even a dialup) link. -p passwd Specify the password required by the ppp daemon. If this switch is not used, pppctl will prompt for a password once it has success- fully connected to ppp. ENVIRONMENT
The following environment variables are understood by pppctl when in interactive mode: EL_SIZE The number of history lines. The default is 20. EL_EDITOR The edit mode. Only values of "emacs" and "vi" are accepted. Other values are silently ignored. This environment variable will override the bind -v and bind -e commands in ~/.editrc. EXAMPLES
If you run ppp in -auto mode, pppctl can be used to automate many frequent tasks (you can actually control ppp in any mode except interactive mode). Use of the -p option is discouraged (even in scripts that are not readable by others) as a ps(1) listing may reveal your secret. The best way to allow easy, secure pppctl access is to create a local server socket in /etc/ppp/ppp.conf (in the correct section) like this: set server /var/run/internet "" 0177 This will instruct ppp to create a local domain socket, with srw------- permissions and no password, allowing access only to the user that invoked ppp. Refer to the ppp(8) man page for further details. You can now create some easy-access scripts. To connect to the internet: #! /bin/sh test $# -eq 0 && time=300 || time=$1 exec pppctl /var/run/internet set timeout $time; dial To disconnect: #! /bin/sh exec pppctl /var/run/internet set timeout 300; close To check if the line is up: #! /bin/sh pppctl -p '' -v /var/run/internet quit | grep ^PPP >/dev/null if [ $? -eq 0 ]; then echo Link is up else echo Link is down fi You can even make a generic script: #! /bin/sh exec pppctl /var/run/internet "$@" You could also use pppctl to control when dial-on-demand works. Suppose you want ppp to run all the time, but you want to prevent dial-out between 8pm and 8am each day. However, any connections active at 8pm should continue to remain active until they are closed or naturally time out. A cron(8) entry for 8pm which runs pppctl /var/run/internet set filter dial 0 deny 0 0 will block all further dial requests, and the corresponding 8am entry pppctl /var/run/internet set filter dial -1 will allow them again. SEE ALSO
ps(1), editline(3), editrc(5), services(5), ppp(8) HISTORY
The pppctl utility first appeared in FreeBSD 2.2.5. BSD
June 26, 1997 BSD
All times are GMT -4. The time now is 01:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy