Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Appending a character(#) with string search at the start of the line Post 302753465 by chandu123 on Tuesday 8th of January 2013 06:53:49 PM
Old 01-08-2013
Appending a character(#) with string search at the start of the line

Hello,

I have been browsing through the forum, but unable to find a solution for my requirement.

I need to go through a file and search for
Code:
/home/users

and insert a # symbol at the start
Code:
/home/users

. Example output is
Code:
#/home/users

.

Can you please help me with the awk or sed command for this.Thank you.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

appending string to text file based on search string

Hi, I need to append string "Hi" to the beginning of the lines containing some specific string. How can I achieve that? Please help. Malay (1 Reply)
Discussion started by: malaymaru
1 Replies

2. Shell Programming and Scripting

Appending string, variable to file at the start and string at end

Hi , I have below file with 13 columns. I need 2-13 columns seperated by comma and I want to append each row with a string "INSERT INTO xxx" in the begining as 1st column and then a variable "$node" and then $2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13 and at the end another string " ; COMMIT;" ... (4 Replies)
Discussion started by: Vaddadi
4 Replies

3. Shell Programming and Scripting

read a string from its end to its start and stop when you find a specific character

How can I do this? Actually I have a file which contains a path e.g. /home/john/Music/hello.mp3 and I want to take only the filename (hello.mp3) So, I need to read the file from its end to its start till the character "/" Is this possible? Thanks, I am sure you'll not disappoint me here! Oh,... (9 Replies)
Discussion started by: hakermania
9 Replies

4. UNIX for Advanced & Expert Users

Appending # to the start of specific line in a properties file

Hi, I have the following file, ABC.txt: ABC=123 DEF=234 FGH=345 Based on my validation and conditional processing it is observed that i need to comment or append # before DEF=234 so the same file ABC.txt should look as follows ABC=123 #DEF=234 FGH=345 Sorry if its a... (6 Replies)
Discussion started by: mihirvora16
6 Replies

5. Shell Programming and Scripting

how to specify start and stop of a search string

I am trying to extract a string from a line of text. Currently I am using grep -o 'startofstring(.........' The string is not always the same size. The string I'm trying to extract starts with 'test(' ends with ')'. ex "blah,blah,blah,test(stringoftext),blah blah" How do I... (4 Replies)
Discussion started by: jeepguy
4 Replies

6. Shell Programming and Scripting

Search for a string, then append character to end of that line only

I have 2 files that I am working with $ cat file1 server1 server3 server5 server6 server8 $ cat file2 server1;Solaris; server2; SLES; server3;Linux; server4; Solaris; server5;SLES; server6;SLES; server7;Solaris; server8;Linux; (1 Reply)
Discussion started by: snoman1
1 Replies

7. Shell Programming and Scripting

Search several string and convert into a single line for each search string using awk command AIX?.

I need to search the file using strings "Request Type" , " Request Method" , "Response Type" and by using result set find the xml tags and convert into a single line?. below are the scenarios. Cat test Nov 10, 2012 5:17:53 AM INFO: Request Type Line 1.... (5 Replies)
Discussion started by: laknar
5 Replies

8. Shell Programming and Scripting

Ls help: ls not working with start character search (^)

Experts, How to list a file using ^ character, for all files started with character a. (os= hp-ux ) # ls -l -rw------- 1 useradm users 0 Mar 26 14:30 abc -rw------- 1 useradm users 0 Mar 26 14:30 def -rw------- 1 useradm users 0 Mar 26... (7 Replies)
Discussion started by: rveri
7 Replies

9. Shell Programming and Scripting

Search string within a file and list common words from the line having the search string

Hi, Need your help for this scripting issue I have. I am not really good at this, so seeking your help. I have a file looking similar to this: Hello, i am human and name=ABCD. How are you? Hello, i am human and name=PQRS. I am good. Hello, i am human and name=ABCD. Good bye. Hello, i... (12 Replies)
Discussion started by: royzlife
12 Replies

10. Shell Programming and Scripting

Printing string from last field of the nth line of file to start (or end) of each line (awk I think)

My file (the output of an experiment) starts off looking like this, _____________________________________________________________ Subjects incorporated to date: 001 Data file started on machine PKSHS260-05CP ********************************************************************** Subject 1,... (9 Replies)
Discussion started by: samonl
9 Replies
Locale::Currency(3perl) 				 Perl Programmers Reference Guide				   Locale::Currency(3perl)

NAME
Locale::Currency - standard codes for currency identification SYNOPSIS
use Locale::Currency; $curr = code2currency('usd'); # $curr gets 'US Dollar' $code = currency2code('Euro'); # $code gets 'eur' @codes = all_currency_codes(); @names = all_currency_names(); DESCRIPTION
The "Locale::Currency" module provides access to standard codes used for identifying currencies and funds, such as those defined in ISO 4217. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default ISO 4217 three-letter codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying currencies. The ones currently supported are: alpha This is a set of three-letter (uppercase) codes from ISO 4217 such as EUR for Euro. Two of the codes specified by the standard (XTS which is reserved for testing purposes and XXX which is for transactions where no currency is involved) are omitted. This code set is identified with the symbol "LOCALE_CURR_ALPHA". This is the default code set. num This is the set of three-digit numeric codes from ISO 4217. This code set is identified with the symbol "LOCALE_CURR_NUMERIC". ROUTINES
code2currency ( CODE [,CODESET] ) currency2code ( NAME [,CODESET] ) currency_code2code ( CODE ,CODESET ,CODESET2 ) all_currency_codes ( [CODESET] ) all_currency_names ( [CODESET] ) Locale::Currency::rename_currency ( CODE ,NEW_NAME [,CODESET] ) Locale::Currency::add_currency ( CODE ,NAME [,CODESET] ) Locale::Currency::delete_currency ( CODE [,CODESET] ) Locale::Currency::add_currency_alias ( NAME ,NEW_NAME ) Locale::Currency::delete_currency_alias ( NAME ) Locale::Currency::rename_currency_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Currency::add_currency_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Currency::delete_currency_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes man page. SEE ALSO
Locale::Codes Locale::Constants http://www.iso.org/iso/support/currency_codes_list-1.htm The ISO 4217 data. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 1997-2001 Canon Research Centre Europe (CRE). Copyright (c) 2001 Michael Hennecke Copyright (c) 2001-2010 Neil Bowers Copyright (c) 2010-2011 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-09-26 Locale::Currency(3perl)
All times are GMT -4. The time now is 02:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy