Sponsored Content
Top Forums Shell Programming and Scripting Deleting double quoted string from a line when line number is variable Post 302832037 by Corona688 on Friday 12th of July 2013 02:34:50 PM
Old 07-12-2013
You can double-quote part of a string, like so:

Code:
sed "$lineno"' s/"[a-zA-Z0-9]*"//' $file

I don't think you need to escape " inside single-quotes(since sed shouldn't need them) as nothing can be escaped inside single quotes anyway.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Adding a columnfrom a specifit line number to a specific line number

Hi, I have a huge file & I want to add a specific text in column. But I want to add this text from a specific line number to a specific line number & another text in to another range of line numbers. To be more specific: lets say my file has 1000 lines & 4 Columns. I want to add text "Hello"... (2 Replies)
Discussion started by: Ezy
2 Replies

2. Shell Programming and Scripting

Deleting a line from a file based on one specific string instance?

Hello! I need to delete one line in a file which matches one very precise instance of a string only. When searching the forum I unfortunately only found a solution which would delete each line on which a particular string occurs. Let's assume I have a file composed of thousands of lines... (4 Replies)
Discussion started by: Black Sun
4 Replies

3. UNIX for Dummies Questions & Answers

How to read contents of a file from a given line number upto line number again specified by user

Hello Everyone. I am trying to display contains of a file from a specific line to a specific line(let say, from line number 3 to line number 5). For this I got the shell script as shown below: if ; then if ; then tail +$1 $3 | head -n $2 else ... (5 Replies)
Discussion started by: grc
5 Replies

4. Solaris

Line too long error Replace string with new line line character

I get a file which has all its content in a single row. The file contains xml data containing 3000 records, but all in a single row, making it difficult for Unix to Process the file. I decided to insert a new line character at all occurrences of a particular string in this file (say replacing... (4 Replies)
Discussion started by: ducati
4 Replies

5. Shell Programming and Scripting

search a string in a particular column of file and return the line number of the line

Hi All, Can you please guide me to search a string in a particular column of file and return the line number of the line where it was found using awk. As an example : abc.txt 7000,john,2,1,0,1,6 7001,elen,2,2,0,1,7 7002,sami,2,3,0,1,6 7003,mike,1,4,0,2,1 8001,nike,1,5,0,1,8... (3 Replies)
Discussion started by: arunshankar.c
3 Replies

6. Shell Programming and Scripting

Deleting a matching string(line) which is also in other lines

Hi, i need help with my shell script I have a file input.txt containing the following contents /. /usr /usr/share /usr/share/doc /usr/share/doc/wine /usr/share/doc/wine/copyright /usr/share/doc/wine/changelog.Debian.gz I need output as /usr/share/doc/wine /usr/share/doc/wine/copyright... (3 Replies)
Discussion started by: Amit0991
3 Replies

7. Shell Programming and Scripting

sed command to replace a line at a specific line number with some other line

my requirement is, consider a file output cat output blah sdjfhjkd jsdfhjksdh sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf hellow there this doesnt look good et cetc etc etcetera i want to replace a line of line number 4 ("this doesnt look good") with some other line ... (3 Replies)
Discussion started by: vivek d r
3 Replies

8. Shell Programming and Scripting

Deleting Line number from different file

file 1 abcde,dfgdfg,sdfds sdfsd,sdfd,sdfg,sdfs dwfds,sdfgdfg,sdfsdf file2 1 3 i need to delete the line numbers file 1 based on file2 i have taken in loop file 1 and i cant able to delete that line number in file 1 Plz help (4 Replies)
Discussion started by: ragu.selvaraj
4 Replies

9. Shell Programming and Scripting

Replace double quotes with a single quote within a double quoted string

Hi Froum. I have tried in vain to find a solution for this problem - I'm trying to replace any double quotes within a quoted string with a single quote, leaving everything else as is. I have the following data: Before: ... (32 Replies)
Discussion started by: pchang
32 Replies
PO(3pm) 						User Contributed Perl Documentation						   PO(3pm)

NAME
Locale::PO - Perl module for manipulating .po entries from GNU gettext SYNOPSIS
use Locale::PO; $po = new Locale::PO([-option=>value,...]) [$string =] $po->msgid([new string]); [$string =] $po->msgstr([new string]); [$string =] $po->comment([new string]); [$string =] $po->automatic([new string]); [$string =] $po->reference([new string]); [$value =] $po->fuzzy([value]); [$value =] $po->add_flag('c-format'); print $po->dump; $quoted_string = $po->quote($string); $string = $po->dequote($quoted_string); $aref = Locale::PO->load_file_asarray(<filename>); $href = Locale::PO->load_file_ashash(<filename>); Locale::PO->save_file_fromarray(<filename>,$aref); Locale::PO->save_file_fromhash(<filename>,$href); DESCRIPTION
This module simplifies management of GNU gettext .po files and is an alternative to using emacs po-mode. It provides an object-oriented interface in which each entry in a .po file is a Locale::PO object. METHODS
new my Locale::PO $po = new Locale::PO; my Locale::PO $po = new Locale::PO(%options); Create a new Locale::PO object to represent a po entry. You can optionally set the attributes of the entry by passing a list/hash of the form: -option=>value, -option=>value, etc. Where options are msgid, msgstr, msgctxt, comment, automatic, reference, fuzzy, and c-format. See accessor methods below. To generate a po file header, add an entry with an empty msgid, like this: $po = new Locale::PO(-msgid=>'', -msgstr=> "Project-Id-Version: PACKAGE VERSION\n" . "PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n" . "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" . "Language-Team: LANGUAGE <LL@li.org>\n" . "MIME-Version: 1.0\n" . "Content-Type: text/plain; charset=CHARSET\n" . "Content-Transfer-Encoding: ENCODING\n"); msgid Set or get the untranslated string from the object. This method expects the new string in unquoted form but returns the current string in quoted form. msgid_plural Set or get the untranslated plural string from the object. This method expects the new string in unquoted form but returns the current string in quoted form. msgstr Set or get the translated string from the object. This method expects the new string in unquoted form but returns the current string in quoted form. msgstr_n Get or set the translations if there are purals involved. Takes and returns a hashref where the keys are the 'N' case and the values are the strings. eg: $po->msgstr_n( { 0 => 'found %d plural translations', 1 => 'found %d singular translation', } ); This method expects the new strings in unquoted form but returns the current strings in quoted form. msgctxt Set or get the translation context string from the object. This method expects the new string in unquoted form but returns the current string in quoted form. obsolete Returns 1 if the entry is obsolete. Obsolete entries have their msgid, msgid_plural, msgstr, msgstr_n and msgctxt lines commented out with "#~" When using load_file_ashash, non-obsolete entries will always replace obsolete entries with the same msgid. comment Set or get translator comments from the object. If there are no such comments, then the value is undef. Otherwise, the value is a string that contains the comment lines delimited with " ". The string includes neither the "# " at the beginning of each comment line nor the newline at the end of the last comment line. automatic Set or get automatic comments from the object (inserted by emacs po-mode or xgettext). If there are no such comments, then the value is undef. Otherwise, the value is a string that contains the comment lines delimited with " ". The string includes neither the "#. " at the beginning of each comment line nor the newline at the end of the last comment line. reference Set or get reference marking comments from the object (inserted by emacs po-mode or gettext). fuzzy Set or get the fuzzy flag on the object ("check this translation"). When setting, use 1 to turn on fuzzy, and 0 to turn it off. c_format Set or get the c-format or no-c-format flag on the object. This can take 3 values: 1 implies c-format, 0 implies no-c-format, and undefined implies neither. php_format Set or get the php-format or no-php-format flag on the object. This can take 3 values: 1 implies php-format, 0 implies no-php-format, and undefined implies neither. has_flag if ($po->has_flag('perl-format')) { ... } Returns true if the flag exists in the entry's #~ comment add_flag $po->add_flag('perl-format'); Adds the flag to the #~ comment remove_flag $po->remove_flag('perl-format'); Removes the flag from the #~ comment loaded_line_number When using one of the load_file_as* methods, this will return the line number that the entry started at in the file. dump Returns the entry as a string, suitable for output to a po file. quote Applies po quotation rules to a string, and returns the quoted string. The quoted string will have all existing double-quote characters escaped by backslashes, and will be enclosed in double quotes. dequote Returns a quoted po string to its natural form. load_file_asarray Given the filename of a po-file, reads the file and returns a reference to a list of Locale::PO objects corresponding to the contents of the file, in the same order. load_file_ashash Given the filename of a po-file, reads the file and returns a reference to a hash of Locale::PO objects corresponding to the contents of the file. The hash keys are the untranslated strings, so this is a cheap way to remove duplicates. The method will prefer to keep entries that have been translated. save_file_fromarray Given a filename and a reference to a list of Locale::PO objects, saves those objects to the file, creating a po-file. save_file_fromhash Given a filename and a reference to a hash of Locale::PO objects, saves those objects to the file, creating a po-file. The entries are sorted alphabetically by untranslated string. AUTHOR
Maintainer: Ken Prows, perl@xev.net Original version by: Alan Schwartz, alansz@pennmush.org BUGS
If you load_file_as* then save_file_from*, the output file may have slight cosmetic differences from the input file (an extra blank line here or there). msgid, msgid_plural, msgstr, msgstr_n and msgctxt expect a non-quoted string as input, but return quoted strings. I'm hesitant to change this in fear of breaking the modules/scripts of people already using Locale::PO. Locale::PO requires blank lines between entries, but Uniforum style PO files don't have any. Please submit all bug requests using CPAN's ticketing system. SEE ALSO
xgettext(1). perl v5.10.0 2008-05-19 PO(3pm)
All times are GMT -4. The time now is 06:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy