Sponsored Content
Top Forums Shell Programming and Scripting how to add single digit in front of the word and line in the file. Post 302513111 by krbala1985 on Tuesday 12th of April 2011 11:11:21 AM
Old 04-12-2011
Hi,

Thanks!.
but i want output similar but slightly changes....in the output file need this type..

4muthu is good boy
3raja is bad boy
selvam in super boy
then 2bala is very good boy

Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Append 0 for single digit entered from command line

I have a script like this-- #!/bin/ksh echo "To pad a 0 before digits from 1-9" for i in $* do echo $i | sed 's//'0'/g' done I run this script as ksh name 1 2 23 34 The output should be 01 02 23 34 Help me in modifying this script. Thanks Namish (2 Replies)
Discussion started by: namishtiwari
2 Replies

2. Shell Programming and Scripting

Adding a word in front of a word of each line.

Adding a word in front of a word of each line.In that line only one word will be there. pl help:( (4 Replies)
Discussion started by: Ramesh Vellanki
4 Replies

3. Shell Programming and Scripting

Want to add a word in front a of each line of a file

Hi, Can anybody help me how to add a word in front of a line in a file.Actually it is bit tricky to add a word. i will give a sample for this: Input : 1110001 ABC DEF 1110001 EFG HIJ 1110001 KLM NOP 1110002 QRS RST 1110002 UVW XYZ Output: %HD% 1110001 ABC DEF %DT% 1110001 EFG HIJ... (4 Replies)
Discussion started by: apjneeraj
4 Replies

4. Shell Programming and Scripting

Place digit in front of the line searching pattern using sed command

hi All, i want to add the single digit front of the line in the report file and string compare with pattern file. patter file: pattern1.txt pattern num like 4 love 3 john 2 report file: report.txt i like very much but john is good boy i will love u so after execute... (9 Replies)
Discussion started by: krbala1985
9 Replies

5. Shell Programming and Scripting

Script for adding a word in front of all line in a file

Hi I've one file full of paths of certain files and I want to add some extra file words in front of all the paths. for eg: i have a file name test.txt which show some details only.. 024_hd/044/0344eng.txt 035_bv/222/editor.jpg here I want to add /usr/people/indiana/ infront of all the... (4 Replies)
Discussion started by: ratheeshp
4 Replies

6. Shell Programming and Scripting

word counts for a single line xml file

I have any XML ouput file(file name TABLE.xml), where the data is loaded in A SINGLE LINE, I need help in writting a ksh shell script which gives me the word counts of word <TABLE-ROW> This is my input file. <?xml version="1.0" encoding="UTF-8"?><!--Generated by Ascential Software... (4 Replies)
Discussion started by: pred55
4 Replies

7. Shell Programming and Scripting

how to delete the line if the first letter is a single digit

Hi, I'm trying to acheive the following, I have a dat file in which i have several addresses, If the address starts with a single digit then i have to delete the line, if it starts with 2 or more digits then i have to keep the line Here is a sample of my file: 377 CARRER DE LA... (5 Replies)
Discussion started by: ramky79
5 Replies

8. Shell Programming and Scripting

convert two digit in to single digit...

Hi Guys. My Input: ABCD 12 00 KL ABCD 12 08 DL ABCD 12 10 KK ABCD 12 04 LL ABCD 13 00 LP ABCD 13 1O LS Output: ABCD 12 0 KL ABCD 12 8 DL ABCD 12 10 KK ABCD 12 4 LL ABCD 13 0 LP (2 Replies)
Discussion started by: pareshkp
2 Replies

9. Shell Programming and Scripting

Insert a single quote in front of a line in vi editor

Hello Gurus, I wanted to put a single quote in every where starting with /oradata, and at the end with .dbf. For example I have one line as below: alter database rename datafile /oradata/test.dbf to /oradata_new/test.dbf I wanted as below alter database rename datafile '/oradata/test.dbf' to... (3 Replies)
Discussion started by: pokhraj_d
3 Replies

10. Shell Programming and Scripting

Checking a single digit in a file using Grep

Hi All, I have a file which keeps count based on completion of a certain activity. I am using the following grep command to return a '1' in case the count is zero grep -ic "0" abc_count.txt Now the issue happens when the count is '10', '20' etc .. in these cases as well it returns a... (5 Replies)
Discussion started by: dev.devil.1983
5 Replies
Config::Model::Backend::Debian::DpkgSyntax(3pm) 	User Contributed Perl Documentation	   Config::Model::Backend::Debian::DpkgSyntax(3pm)

NAME
Config::Model::Backend::Debian::DpkgSyntax - Role to read and write files with Dpkg syntax VERSION
version 2.021 SYNOPSIS
package MyParser ; use Log::Log4perl qw(:easy); Log::Log4perl->easy_init($WARN); use Any::Moose ; with 'Config::Model::Backend::Debian::DpkgSyntax'; package main ; use IO::File ; use Data::Dumper ; my $data = [ [ qw/Name Foo Version 1.2/ ], [ qw/Name Bar Version 1.3/ , Files => [qw/file1 file2/] , Description => "A very long description" ] ] ; my $fhw = IO::File->new ; $fhw -> open ( 'dpkg_file' ,'>' ) ; my $parser = MyParser->new() ; $parser->write_dpkg_file($fhw,$data) ; "dpkg_file" will contain: Name: Foo Version: 1.2 Name: Bar Version: 1.3 Files: file1, file2 Description: A very . long description DESCRIPTION
This module is a Moose role to read and write dpkg control files. Debian control file are read and transformed in a list of list matching the control file. The top level list of a list of section. Each section is mapped to a list made of keywords and values. Since this explanation is probably too abstract, here's an example of a file written with Dpkg syntax: Name: Foo Version: 1.1 Name: Bar # boy, new version Version: 1.2 Description: A very . long description Once parsed, this file will be stored in the following list of list : ( [ Name => 'Foo', Version => '1.1' ], [ Name => 'Bar', Version => [ '1.2' 'boy, new version' ], Description => "A very long description" ] ) Note: The description is changed into a paragraph without the Dpkg syntax idiosyncrasies. The leading white space is removed and the single dot is transformed in to a " ". These characters will be restored when the file is written back. Last not but not least, this module can be re-used outside of "Config::Model" with some small modifications in exception handing. Ask the author if you want this module shipped in its own distribution. parse_dpkg_file ( file_handle, check, comment_allowed ) Read a control file from the file_handle and returns a nested list (or a list ref) containing data from the file. The returned list is of the form : [ # section 1 [ keyword1 => value1, # for text or simple values keyword2 => value2, # etc ], # section 2 [ ... ] # etc ... ] check is "yes", "skip" or "no". "comment_allowed" is boolean (default 0) When comments are provided in the dpkg files, the returned list is of the form : [ [ keyword1 => [ value1, 'value1 comment'] keyword2 => value2, # no comment ], [ ... ] ] parse_dpkg_lines (lines, check, comment_allowed ) Parse the dpkg date from lines (which is an array ref) and return a data structure like parse_dpkg_file. write_dpkg_file ( io_handle, list_ref, list_sep ) Munge the passed list ref into a string compatible with control files and write it in the passed file handle. The input is a list of list in a form similar to the one generated by parse_dpkg_file: [ section [ keyword => value | value_list ] ] Except that the value may be a SCALAR or a list ref. In case, of a list ref, the list items will be joined with the value "list_sep" before being written. Values will be aligned in case of multi-line output of a list. For instance the following code : my $ref = [ [ Foo => 'foo value' , Bar => [ qw/v1 v2/ ] ]; write_dpkg_file ( $ioh, $ref, ', ' ) will yield: Foo: foo value Bar: v1, v2 AUTHOR
Dominique Dumont, (ddumont at cpan dot org) SEE ALSO
Config::Model, Config::Model::AutoRead, Config::Model::Backend::Any, perl v5.14.2 2012-11-09 Config::Model::Backend::Debian::DpkgSyntax(3pm)
All times are GMT -4. The time now is 09:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy