Sponsored Content
Top Forums Shell Programming and Scripting Append to exisiting file on same line. Post 302377072 by dinjo_jo on Thursday 3rd of December 2009 04:40:35 AM
Old 12-03-2009
Says
Illegal variable name.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Large file need to append to each line

I have a few large files that need to have a ,A appended to the end of each record. I though about using sed but never used it before and the man is not intuitive nor have I found examples. This is what I tried for file name bob sed '\a,A' bob from what I get if you do not supply a range... (1 Reply)
Discussion started by: r1500
1 Replies

2. UNIX for Dummies Questions & Answers

How to Append a Value to each line of the file

Hi, We have Multiple source files which has some data, I need a K shell script which will append number '1' as the last character to all the lines of the first file and then increments the value and appends '2' to all the lines to the next file and so on. For Example Incoming file 1 ... (11 Replies)
Discussion started by: dsshishya
11 Replies

3. Shell Programming and Scripting

Append each line to next previous line in a file

Hi all, Please help me in providing sample code to append the following 4 lines in one row. Input : A1/EXT "BAPBSC10/07B/00" 523 090530 0115 RXOCF-430 HY1711 1 EXTERNAL ALARM DOOR ALARM Output should be : A1/EXT "BAPBSC10/07B/00" 523 090530 0115 ... (8 Replies)
Discussion started by: sudhakaryadav
8 Replies

4. Shell Programming and Scripting

shell script to read a line in gps receiver log file and append that line to new file

Hi, I have gps receiver log..its giving readings .like below Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GPSD,R=1 $GPGSV,3,1,11,08,16,328,40,11,36,127,00,28,33,283,39,20,11,165,00*71... (3 Replies)
Discussion started by: gudivada213
3 Replies

5. Shell Programming and Scripting

append a line into a file in the top

hi, My code is #!/bin/sh echo "\n\nPlease enter the month of the year(YYYYMM) : \c" read date_rep INPUT_L9_FILE=L9_Recharge_Description_EOM_$date_rep.csv #This part is used to summarise Grand_Total, Balance_Total of file L9_Recharge_Description_EOM_${1}.csv. awk -F"," '{if(NR!=1)... (5 Replies)
Discussion started by: madfox
5 Replies

6. Shell Programming and Scripting

How to append text to the second line of a file

Say I have a text file like: 1 3 4 How would I use ksh to put the number '2' into the second line of that file? I'm using OpenBSD so the sed syntax might be a bit different (I have no idea how to use sed, though) (4 Replies)
Discussion started by: guitarscn
4 Replies

7. Shell Programming and Scripting

Append string to first line of a file

Hi, Please suggest me to write unix command, HEADER20110101 string append to first line of a file.. Regards Akshu (3 Replies)
Discussion started by: akshu.agni
3 Replies

8. Shell Programming and Scripting

conditional append one line in file.

Hi, Unix gurus, I have a requirement as following: checking existing file, if the file only contain one line. then append "No data" else keep existing file as is. can i achieve this by in command line without write a script. :wall: Thanks in advance. (4 Replies)
Discussion started by: ken002
4 Replies

9. Shell Programming and Scripting

Append file name to the beginning of each line

I want to append file names at the beginning of a line for each row file content abc.txt.gz 123|654|987 bcd.txt.gz 876|trf|kjh I want a single output file with below format abc.txt.gz|123|654|987 bcd.txt.gz|876|trf|kjh This one is working but only with unzip files,need to have... (3 Replies)
Discussion started by: rakesh5300
3 Replies

10. Shell Programming and Scripting

How to remove exisiting file content from a file and have to append new file content?

hi all, i had the below script x=`cat input.txt |wc -1` awk 'NR>1 && NR<'$x' ' input.txt > output.txt by using above script i am able to remove the head and tail part from the input file and able to append the output to the output.txt but if i run it for second time the output is... (2 Replies)
Discussion started by: hemanthsaikumar
2 Replies
Devel::DollarAt(3pm)					User Contributed Perl Documentation				      Devel::DollarAt(3pm)

NAME
Devel::DollarAt - Give magic abilities to $@ SYNOPSIS
use Devel::DollarAt; eval "0/0"; print $@, $@->backtrace; $@->redie; DESCRIPTION
Using eval {}, you may catch Perl exceptions almost like you do it with try {} in Java. However there are days when you miss some features of exceptions. The only thing you know about the error that occured is the string $@, which combines the error message and technical data like the line number. The Devel::DollarAt module gives some functionality to the $@ scalar. Once you say "use Devel::DollarAt", the module is active program- wide. If an exception occurs anywhere in any module, $@ will be globally set to an object of class Devel::DollarAt. Apart from performance, this shouldn't be a problem because $@ tries to be downwardly compatible to the normal $@. However using this package in CPAN modules or large software projects is discouraged. DISCLAIMER
Use this module only for debugging. Don't think of it as an exception framework for Perl or something like that. It just gives magic abilities to $@, that's all. METHODS
backtrace Returns a Devel::Backtrace object, which lets you inspect the callers of the fatality. filename Returns the name of the file in which the error occured. inputhandle Returns the file handle which has most recently be read from at the time of the error. inputline Returns the line number of "$@->inputhandle" (which is $.) at the time of the error. line Returns the number of the line in which the error occured. redie Redispatches this exception to the next eval{}. redispatch_points Returns a list of objects with informations about when this exception was redispatched. Each object has got the accessors "package", "filename" and "line". In string context, the objects will look like "redispatched from FooPackage at file.pl:17 ". to_string Returns a string that looks quite like the normal $@, e. g. "Illegal division by zero at foo.pl line 42, <> line 13." Devel::DollarAt overloads the "" (stringification) operator to this method. EXAMPLES
A very simple (and pointless) way to use Devel::DollarAt is this oneliner: perl -MDevel::DollarAt -e '0/0' It bails out with "Illegal division by zero at -e line 1." and an exit status of 1, just like it would have done if you hadn't supplied -MDevel::DollarAt. This is because the magically modified $@ variable gets stringified when perl prints it as exit reason. If you actually want to see the difference, use perl -MDevel::DollarAt=frame -e '0/0' This bails out with "[[Illegal division by zero at -e line 1.]]" so you can see that something has happened. KNOWN PROBLEMS
This module requires that no other code tampers with $SIG{__DIE__} or *CORE::GLOBAL::die. A not widely known feature of Perl is that it can propagate $@. If you call die() without parameters or with an empty string or an undefined value, the error message will be "Died". However, if $@ was set to some value before this, the previous error message will be used with " ...propagated" appended: perl -e '$@="7"; die" 7 ...propagated at -e line 1. Devel::DollarAt emulates this behaviour. If you use the above example but leave out the double quotes, perl's behaviour is different as of version 5.8.8: perl -e '$@=7; die' 7 at -e line 1. Devel::DollarAt does not emulate this behaviour: perl -MDevel::DollarAt -e '$@=7; die' 7 ...propagated at -e line 1. If a previous $@ is propagated, inputhandle and inputline won't work. They won't be interpolated into the stringified $@, either. If perl comes across syntax errors, $@ appears to be just a string as usual. Apparently $SIG{__DIE__} won't be called for syntax errors. AUTHOR
Christoph Bussenius <pepe@cpan.org> If you use this module, I'll be glad if you drop me a note. You should mention this module's name in the subject of your mails, in order to make sure they won't get lost in all the spam. LICENSE
This module is in the public domain. If your country's law does not allow this module being in the public domain or does not include the concept of public domain, you may use the module under the same terms as perl itself. perl v5.10.0 2009-01-27 Devel::DollarAt(3pm)
All times are GMT -4. The time now is 01:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy