Insert Text On file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Insert Text On file
# 1  
Old 08-20-2009
hi shazin,

When iam doing this iamgetting error


Code:
$ sed '1i\ USER_ID, LOGIN_ID' userdata.csv >newfile
sed: command garbled: 1i\ USER_ID, LOGIN_ID

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to insert text within a file?

Hi, I am trying to check for missing dates in a file and would want to insert the missing date into the file. Currently the script is as below #!/bin/ksh dates="dates" cat ${dates} | grep -v "^#" curr_month=`date '+%m` curr_day=`date '+%d` curr_year=`date '+%Y` #curr_month=02... (7 Replies)
Discussion started by: newbie_01
7 Replies

2. Shell Programming and Scripting

How to insert text using a second file in Linux

How can i insert text at a particular line number or before/after a search pattern? The text i want to insert is of 8-10 lines including new line characters. I have stored this text in a separate file. I know i can use sed '{/pattern/|/regexp/|n}{i|a|c}<text to be inserted>' file But i want... (7 Replies)
Discussion started by: abhitanshu
7 Replies

3. Shell Programming and Scripting

Insert value to db from text file

Hi, I have a single value in insertval file. I want to load that value to database with the current date. I tried the below code but it is inserting <NULL> to database and echo $c is also null. cat insertval | awk -F ' ' '{print $1}' > c echo c=$c data=`sqlplus -s user/pwd@hostname <<EOF ... (5 Replies)
Discussion started by: Neethu
5 Replies

4. UNIX for Dummies Questions & Answers

insert comma in a text file

Hi all, I have a text file and I need to insert comma after every 2 digit. -1-1-1-1-1-1-1-1-1 0 0 0 -1-1-1 2 0 0 3 311-1 0 1 -1-1 021 0 011-1-1 033 0I'd like to have this: -1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0 -1,-1,-1, 2, 0, 0, 3, 3,11,-1, 0, 1 -1,-1, 0,21, 0, 0,11,-1,-1, 0,33, 0Thanks for... (7 Replies)
Discussion started by: GoldenFire
7 Replies

5. Shell Programming and Scripting

Insert text to file via ssh

I want to create a script that will set up key pairs from "thishost" to "remotehosts". I have a validate script in ~/<dir> that I need to prefix the generated key in the authorized_keys file, and I'm having to manually do this everytime. Here are my attemps, perhaps you could perfect them for... (3 Replies)
Discussion started by: ScannerDarkly
3 Replies

6. Shell Programming and Scripting

Need to insert new text and change existing text in a file using SED

Hi all, I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output. sed '$a\ hi... ' shell > shell1 But I face problem when using the same in script. It is throwing the error as, sed: command garbled:... (4 Replies)
Discussion started by: iamgeethuj
4 Replies

7. Shell Programming and Scripting

How to insert some constant text at beginig of each line within a text file.

Dear Folks :), I am new to UNIX scripting and I do not know how can I insert some text in the first column of a UNIX text file at command promtp. I can do this in vi editor by using this command :g/^/s//BBB_ e,g I have a file named as Test.dat and it containins below text: michal... (4 Replies)
Discussion started by: Muhammad Afzal
4 Replies

8. UNIX for Dummies Questions & Answers

How to insert text in the middle of a file

Hey guys, how do we take a line of text as an argument from a user and then insert it in the middle of a file irrespective of the number of lines in the file. I am trying to do this without SED or AWK. Inserting it in the beginning and at the end is easy, but i am trying to accomplish inserting... (6 Replies)
Discussion started by: kartikkumar84@g
6 Replies

9. Shell Programming and Scripting

insert text in the middle of a file

I want to insert a text into the middle of a file (3 Replies)
Discussion started by: relle
3 Replies

10. UNIX for Dummies Questions & Answers

insert text into a dinamic file

I need help, It's probably a joke for you, but I'm about to explode: This is it: I have a file which is created by batch, and includes a list of db files (with the complete path). I want to use this list for a graph file - in order to exclude it from the daily backup. it means i need to add an... (2 Replies)
Discussion started by: sunbird
2 Replies
Login or Register to Ask a Question
BATCH(P)						     POSIX Programmer's Manual							  BATCH(P)

NAME
batch - schedule commands to be executed in a batch queue SYNOPSIS
batch DESCRIPTION
The batch utility shall read commands from standard input and schedule them for execution in a batch queue. It shall be the equivalent of the command: at -q b -m now where queue b is a special at queue, specifically for batch jobs. Batch jobs shall be submitted to the batch queue with no time constraints and shall be run by the system using algorithms, based on unspecified factors, that may vary with each invocation of batch. Users shall be permitted to use batch if their name appears in the file /usr/lib/cron/at.allow. If that file does not exist, the file /usr/lib/cron/at.deny shall be checked to determine whether the user shall be denied access to batch. If neither file exists, only a process with the appropriate privileges shall be allowed to submit a job. If only at.deny exists and is empty, global usage shall be per- mitted. The at.allow and at.deny files shall consist of one user name per line. OPTIONS
None. OPERANDS
None. STDIN
The standard input shall be a text file consisting of commands acceptable to the shell command language described in Shell Command Language . INPUT FILES
The text files /usr/lib/cron/at.allow and /usr/lib/cron/at.deny shall contain zero or more user names, one per line, of users who are, respectively, authorized or denied access to the at and batch utilities. ENVIRONMENT VARIABLES
The following environment variables shall affect the execution of batch: LANG Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of IEEE Std 1003.1-2001, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) LC_ALL If set to a non-empty string value, override the values of all the other internationalization variables. LC_CTYPE Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments and input files). LC_MESSAGES Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informative messages written to standard output. LC_TIME Determine the format and contents for date and time strings written by batch. NLSPATH Determine the location of message catalogs for the processing of LC_MESSAGES . SHELL Determine the name of a command interpreter to be used to invoke the at-job. If the variable is unset or null, sh shall be used. If it is set to a value other than a name for sh, the implementation shall do one of the following: use that shell; use sh; use the login shell from the user database; any of the preceding accompanied by a warning diagnostic about which was chosen. TZ Determine the timezone. The job shall be submitted for execution at the time specified by timespec or -t time relative to the time- zone specified by the TZ variable. If timespec specifies a timezone, it overrides TZ . If timespec does not specify a timezone and TZ is unset or null, an unspecified default timezone shall be used. ASYNCHRONOUS EVENTS
Default. STDOUT
When standard input is a terminal, prompts of unspecified format for each line of the user input described in the STDIN section may be written to standard output. STDERR
The following shall be written to standard error when a job has been successfully submitted: "job %s at %s ", at_job_id, <date> where date shall be equivalent in format to the output of: date +"%a %b %e %T %Y" The date and time written shall be adjusted so that they appear in the timezone of the user (as determined by the TZ variable). Neither this, nor warning messages concerning the selection of the command interpreter, are considered a diagnostic that changes the exit status. Diagnostic messages, if any, shall be written to standard error. OUTPUT FILES
None. EXTENDED DESCRIPTION
None. EXIT STATUS
The following exit values shall be returned: 0 Successful completion. >0 An error occurred. CONSEQUENCES OF ERRORS
The job shall not be scheduled. The following sections are informative. APPLICATION USAGE
It may be useful to redirect standard output within the specified commands. EXAMPLES
1. This sequence can be used at a terminal: batch sort < file >outfile EOT 2. This sequence, which demonstrates redirecting standard error to a pipe, is useful in a command procedure (the sequence of output redi- rection specifications is significant): batch << ! diff file1 file2 2>&1 >outfile | mailx mygroup ! RATIONALE
Early proposals described batch in a manner totally separated from at, even though the historical model treated it almost as a synonym for at -qb. A number of features were added to list and control batch work separately from those in at. Upon further reflection, it was decided that the benefit of this did not merit the change to the historical interface. The -m option was included on the equivalent at command because it is historical practice to mail results to the submitter, even if all job-produced output is redirected. As explained in the RATIONALE for at, the now keyword submits the job for immediate execution (after scheduling delays), despite some historical systems where at now would have been considered an error. FUTURE DIRECTIONS
None. SEE ALSO
at COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 BATCH(P)