03-26-2010
Add to constant fields at the end of every line
Hi,
I want to add two fields with values '1000' and 'XYZ-1234' at the end of every line in a comma delimited file.
Should I use any command in a loop to add the fields or using any single command Shall I acheive it?
Kindly help me in code.
Thanks,
Poova.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Does anyone know if its possible to add something like an end of line like c or java in unix?
dirs=/home/nosnam
var=''
for dir in $dirs
do
listDirs=`ls -d1 $dir/*`
for eachList in $listDirs
do
listRepos=`du -ks $eachList | awk '{ x+=$1 }; END { print x... (4 Replies)
Discussion started by: nosnam
4 Replies
2. Shell Programming and Scripting
Hi,
I need some help in knowing how I can append tabs at the end of each line...
The data looks something like this:
field1, field2, field3, field4
1 2
3 4 5
I have values in field1 and field 2 in the first row and I would like to append tab on field3 and field4 for the first row..and in... (6 Replies)
Discussion started by: madhunk
6 Replies
3. UNIX for Advanced & Expert Users
Hi i would like to add line numbers to end of each line in a file.
I am able to do it in the front of each line using sed, but not able to add at the end of the file.
Can anyone suggest
The following code adds line number to start of each line
sed = filename | sed 'N;s/\n/\t/'
how can i... (5 Replies)
Discussion started by: rudoraj
5 Replies
4. Shell Programming and Scripting
hi,
i have file which is having large sql query
eg :
i am executing this sql file but now i want to add ; after query on same line
i.e. i should look like
any idea how to achieve it ? (6 Replies)
Discussion started by: crackthehit007
6 Replies
5. Shell Programming and Scripting
I have a file with varying record length in it. I need to reformat this file so that each line will have a length of 100 characters (99 characters + the line feed).
AU * A01 EXPENSE 6990370000 CWF SUBC TRAVEL & MISC
MY * A02 RESALE 6990788000 Y... (3 Replies)
Discussion started by: udelalv
3 Replies
6. Shell Programming and Scripting
Hello
How can I add a string (always the same) at the end of a specific line in a file...
The file is:
000000001 041 L $$aspa
000000001 088 L $$aJ.E.N. 551
000000001 090 L $$aINFORMES JEN
000000001 100 L $$aautor 1
----
000000002 041 L $$aeng
000000002 088 L $$aJ.E.N. 1... (13 Replies)
Discussion started by: ldiaz2106
13 Replies
7. Shell Programming and Scripting
How to add a comma at the end of each line in this file?30 1412
30 3352
30 5254
30 5543
30 7478
3 28
3 30
3 39
3 54
3 108
3 152
3 178
3 182
3 214
3 271
3 286
3 300
3 348
3 349
3 371 (3 Replies)
Discussion started by: gunjan
3 Replies
8. Shell Programming and Scripting
Hello,
file.dat
1,2,3,4,5,6,7,8
1,2,3,4,5,6
1,2,3,4
I need to output the value in the third column from the end:
6
4
2
Thanks! (2 Replies)
Discussion started by: palex
2 Replies
9. Shell Programming and Scripting
i want to add a white-space at the end of each line for my inp.file, but when i do it, the result is a new line with a white-space between each line!
my input:
2012 0811 1223 15.2 L 38.393 46.806 9.0 Teh 78 0.5 6.5LTeh 1
GAP=74 ... (5 Replies)
Discussion started by: saeed.soltani
5 Replies
10. Shell Programming and Scripting
Seems simple but ive been searching for a good hour of so
I have a text file and would like to add a string to the end of line 5 ( as an example)
to ake tings hard the line number we have to add the text to is stored in a variable cunningly name $Line_to_append
any ideas on how this could... (2 Replies)
Discussion started by: dunryc
2 Replies
LEARN ABOUT DEBIAN
debian::control::stanza::commaseparated
Debian::Control::Stanza::CommaSeparated(3pm) User Contributed Perl Documentation Debian::Control::Stanza::CommaSeparated(3pm)
NAME
Debian::Control::Stanza::CommaSeparated - comma separated debian/control field abstraction
SYNOPSYS
my $f = Debian::Control::Stanza::CommaSeparated->new(
'Joe M <joem@there.not>');
$f->add('"Smith, Agent" <asmith@hasyou.not>, Joe M <joem@there.not>');
print $f->as_string;
# 'Joe M <joem@there.not>, "Smith, Agent" <asmith@hasyou.not>'
print "$f"; # the same
$f->sort;
DESCRIPTION
Debian::Control::Stanza::CommaSeparated abstracts handling of comma-separated list of values, often found in debian/control file fields
like Uploaders. Note that the various dependency fields in debian/control also use comma-separated values, but the Debian::Dependencies
class is more suitable for these as it is for example also capable of finding overlapping dependency declarations.
CONSTRUCTOR
new (initial values)
The initial values list is parsed and may contain strings that are in fact comma-separated lists. These are split appropriately using
Text::ParseWords' quotewords routine.
METHODS
as_string
Returns text representation of the list. A simple join of the elements by ", ".
The same function is used for overloading the stringification operation.
add @items
Adds the ginen items to the list. Items that are already present are not added, keeping the list unique.
sort
A handy method for sorting the list.
perl v5.14.2 2012-01-15 Debian::Control::Stanza::CommaSeparated(3pm)