Sponsored Content
Full Discussion: Eof
Top Forums UNIX for Dummies Questions & Answers Eof Post 302101268 by fiol73 on Saturday 30th of December 2006 05:45:02 AM
Old 12-30-2006
thanx but didnt solve the problem

hi! thanks for your help but your solution did not quite solve the problem so I'll try to explain it better! If you type this command directly in the shell:

paste - file (where 'file' is a text file you have somewhere!)

you will see that you will be prompt for some input and for every line you'll type, the shell will output the content of your file one line at the time. To exit you will have to press CTRL+C, otherwise you'll remain in the paste interactive mode.

What i am trying to achieve is this same thing but in a more friendly interactive way, so that the user will be prompt for filename and input and the two things will be merged together, one line at the time, (and not appended at the end of the file as you suggest) and eventually saved in a new file if the user wants to. My problem is that I dont know how to tell the shell when to stop so i know how i can make my user enter the 'paste' modality but dont know how to stop the process. So let's say i have a file "names" which contains

John
Nora
Andrew

Maybe the user wants to merge these names with some input like numbers or scores:

so he/she will type:
1
and the programme will answer with
1 John
then:
2
2 Nora
finally:
3
3 Andrew
and now that we are at the end of the file 'names', I want to exit and maybe to save this new merged file in a new file!

Hope my explanation makes it easier to understand. Any solution? thanks, stef Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

EOF use

Hi, I'd like to access a windows directory from aix with samba client. To allow direct access (not interactive), i'm using EOF like: smbclient \\\\winserver\\windir 'passwd' -U usersmb << EOF cd subwindir put myfile EOF The access is correct but does somebody know how to trap errors... (1 Reply)
Discussion started by: jo_aze
1 Replies

2. Shell Programming and Scripting

Please help with EOF

Hello, you are an awesome crowd! You answered my last questions, thank you sooo much! I am trying to write a korn shell script that will record the memory my application is using (HP-UX B.11.11) and I have this: if (( $APP > $THRESHOLD )) then echo "Warning message will display" cat... (2 Replies)
Discussion started by: satraver
2 Replies

3. Shell Programming and Scripting

Premature EOF

How to check for a premature EOF in a regular file in a shell/perl script? I want to check if I have received a complete file or not. Thanks, Rahul. (12 Replies)
Discussion started by: rahulrathod
12 Replies

4. UNIX for Dummies Questions & Answers

Eof

hello all, how end of a file is detected in UNIX system? does it make use of any special symbols to identify the EOF? :( thank you all (5 Replies)
Discussion started by: compbug
5 Replies

5. Shell Programming and Scripting

Eof

hi, in a shell script i came accross the following bit of code 1.shift $(($OPTIND - 1)) 2.if ; then 3. cat << EOF >&2 4.Usage: $0 lockfilename 5.EOF 6. exit 1 7.fi I am not able to understand the meaning of lines(1,3,5). Can any one of u tell me the purpose of above said lines.... (1 Reply)
Discussion started by: ravi raj kumar
1 Replies

6. UNIX for Dummies Questions & Answers

\n after EOF

Hello all, I have unix file that ends with the following EOF '9999999999' I want to remove the '\n' character after EOF. What is the command that should be included in the script, before sending the file? will this work: $ echo "<99999999999>\c" >> <filename> thanks in advance. (3 Replies)
Discussion started by: priya12
3 Replies

7. Shell Programming and Scripting

What is << EOF

I'm trying to connect to oracle with the following code in the script: checksqlerror{ if echo $1 exit fi } $SQLPLUS username/password@schemaname checksqlerror "failed to connect to oracle" If I'm passing wrong schema name,instead of executing checksqlerror it stops and expects user... (2 Replies)
Discussion started by: BhawanaAggarwal
2 Replies

8. Programming

Eof

How can I write EOF into a file? I tryed to do as follows: size=sizeof(EOF); end_of_file=EOF; write(fdMutexRichieste, &end_of_file, size); But it does non work correctly, becouse in the next cicle (using lseek(..., SEEK_END) of my code it seems to ignore my EOF and use the LAST... (5 Replies)
Discussion started by: DNAx86
5 Replies

9. Shell Programming and Scripting

Until eof do????

Hey! Can I write a routine that allows me to in a txt file check line by line until the end of file? something like until do ---some code--- done maybe it is a stupid question but I never learned shell scripts and I need this :p thanks in advance (1 Reply)
Discussion started by: ruben.rodrigues
1 Replies

10. Shell Programming and Scripting

confused with << EOF EOF

Hi friends , I am confused with << EOF EOF Most of the cases I found sqlplus $db_conn_str << EOF some sql staments EOF another exapmle is #!/bin/sh echo -n 'what is the value? ' read value sed 's/XXX/'$value'/' <<EOF The value is XXX EOF (1 Reply)
Discussion started by: imipsita.rath
1 Replies
KRB5_CONTEXT(3) 					   BSD Library Functions Manual 					   KRB5_CONTEXT(3)

NAME
krb5_add_et_list, krb5_add_extra_addresses, krb5_add_ignore_addresses, krb5_context, krb5_free_config_files, krb5_free_context, krb5_get_default_config_files, krb5_get_dns_canonize_hostname, krb5_get_extra_addresses, krb5_get_fcache_version, krb5_get_ignore_addresses, krb5_get_kdc_sec_offset, krb5_get_max_time_skew, krb5_get_use_admin_kdc krb5_init_context, krb5_init_ets, krb5_prepend_config_files, krb5_prepend_config_files_default, krb5_set_config_files, krb5_set_dns_canonize_hostname, krb5_set_extra_addresses, krb5_set_fcache_version, krb5_set_ignore_addresses, krb5_set_max_time_skew, krb5_set_use_admin_kdc, -- create, modify and delete krb5_context structures LIBRARY
Kerberos 5 Library (libkrb5, -lkrb5) SYNOPSIS
#include <krb5.h> struct krb5_context; krb5_error_code krb5_init_context(krb5_context *context); void krb5_free_context(krb5_context context); void krb5_init_ets(krb5_context context); krb5_error_code krb5_add_et_list(krb5_context context, void (*func)(struct et_list **)); krb5_error_code krb5_add_extra_addresses(krb5_context context, krb5_addresses *addresses); krb5_error_code krb5_set_extra_addresses(krb5_context context, const krb5_addresses *addresses); krb5_error_code krb5_get_extra_addresses(krb5_context context, krb5_addresses *addresses); krb5_error_code krb5_add_ignore_addresses(krb5_context context, krb5_addresses *addresses); krb5_error_code krb5_set_ignore_addresses(krb5_context context, const krb5_addresses *addresses); krb5_error_code krb5_get_ignore_addresses(krb5_context context, krb5_addresses *addresses); krb5_error_code krb5_set_fcache_version(krb5_context context, int version); krb5_error_code krb5_get_fcache_version(krb5_context context, int *version); void krb5_set_dns_canonize_hostname(krb5_context context, krb5_boolean flag); krb5_boolean krb5_get_dns_canonize_hostname(krb5_context context); krb5_error_code krb5_get_kdc_sec_offset(krb5_context context, int32_t *sec, int32_t *usec); krb5_error_code krb5_set_config_files(krb5_context context, char **filenames); krb5_error_code krb5_prepend_config_files(const char *filelist, char **pq, char ***ret_pp); krb5_error_code krb5_prepend_config_files_default(const char *filelist, char ***pfilenames); krb5_error_code krb5_get_default_config_files(char ***pfilenames); void krb5_free_config_files(char **filenames); void krb5_set_use_admin_kdc(krb5_context context, krb5_boolean flag); krb5_boolean krb5_get_use_admin_kdc(krb5_context context); time_t krb5_get_max_time_skew(krb5_context context); krb5_error_code krb5_set_max_time_skew(krb5_context context, time_t time); DESCRIPTION
The krb5_init_context() function initializes the context structure and reads the configuration file /etc/krb5.conf. The structure should be freed by calling krb5_free_context() when it is no longer being used. krb5_init_context() returns 0 to indicate success. Otherwise an errno code is returned. Failure means either that something bad happened during initialization (typically [ENOMEM]) or that Kerberos should not be used [ENXIO]. krb5_init_ets() adds all com_err(3) libs to context. This is done by krb5_init_context(). krb5_add_et_list() adds a com_err(3) error-code handler func to the specified context. The error handler must generated by the the re-ren- trant version of the compile_et(1) program. krb5_add_extra_addresses() add a list of addresses that should be added when requesting tickets. krb5_add_ignore_addresses() add a list of addresses that should be ignored when requesting tickets. krb5_get_extra_addresses() get the list of addresses that should be added when requesting tickets. krb5_get_ignore_addresses() get the list of addresses that should be ignored when requesting tickets. krb5_set_ignore_addresses() set the list of addresses that should be ignored when requesting tickets. krb5_set_extra_addresses() set the list of addresses that should be added when requesting tickets. krb5_set_fcache_version() sets the version of file credentials caches that should be used. krb5_get_fcache_version() gets the version of file credentials caches that should be used. krb5_set_dns_canonize_hostname() sets if the context is configured to canonicalize hostnames using DNS. krb5_get_dns_canonize_hostname() returns if the context is configured to canonicalize hostnames using DNS. krb5_get_kdc_sec_offset() returns the offset between the localtime and the KDC's time. sec and usec are both optional argument and NULL can be passed in. krb5_set_config_files() set the list of configuration files to use and re-initialize the configuration from the files. krb5_prepend_config_files() parse the filelist and prepend the result to the already existing list pq The result is returned in ret_pp and should be freed with krb5_free_config_files(). krb5_prepend_config_files_default() parse the filelist and append that to the default list of configuration files. krb5_get_default_config_files() get a list of default configuration files. krb5_free_config_files() free a list of configuration files returned by krb5_get_default_config_files(), krb5_prepend_config_files_default(), or krb5_prepend_config_files(). krb5_set_use_admin_kdc() sets if all KDC requests should go admin KDC. krb5_get_use_admin_kdc() gets if all KDC requests should go admin KDC. krb5_get_max_time_skew() and krb5_set_max_time_skew() get and sets the maximum allowed time skew between client and server. SEE ALSO
errno(2), krb5(3), krb5_config(3), krb5_context(3), kerberos(8) HEIMDAL
December 8, 2004 HEIMDAL
All times are GMT -4. The time now is 11:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy