Sponsored Content
Full Discussion: Add string to parentheses
Top Forums UNIX for Beginners Questions & Answers Answers to Frequently Asked Questions Add string to parentheses Post 302970466 by nandanlbhat on Wednesday 6th of April 2016 09:16:14 PM
Old 04-06-2016
sed can do the substitution

If you have the code in
Code:
/tmp/test.c

, try

Code:
sed -e "s/()/(void)/" /tmp/test.c

to see/preview it and

Code:
sed -i.bak -e "s/()/(void)/" /tmp/test.c

for an in-place substitution within the file. If anything goes wrong,
Code:
/tmp/test.c.bak

should have the original that you started with.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parentheses in perl find/replace

I'm trying to use the following command to do a batch find and replace in all commonly named files through a file hierarchy find . -name 'file' |xargs perl -pi -e 's/find/replace/g' which works fine except for a substitution involving parenthesis. As a specific example I'm trying to sub... (3 Replies)
Discussion started by: Jeffish
3 Replies

2. Shell Programming and Scripting

Replace text in parentheses

Hi I would like to replace a comma in parentheses to a semicolon for example. Other commas outside () stay unchanged. How can I do this? aaaa,bbb,ccc,ddd(eee,fff,ggg),hhh,iii to aaaa,bbb,ccc,ddd(eee;fff;ggg),hhh,iii Thanks (5 Replies)
Discussion started by: lalelle
5 Replies

3. UNIX for Dummies Questions & Answers

brackets vs parentheses - single and double

hi, unix gurus. i am wondering if someone can give me a clear explanation of the differneces between parentheses and brackets, both single and double. i have heard that double parentheses (( are used for numerical expressions and that single brackets [ are used for strings. but i see... (1 Reply)
Discussion started by: ankimo
1 Replies

4. Shell Programming and Scripting

Perl regex help - matching parentheses

Let's say I'm trying to match potentially multiple sets of parentheses. Is there a way in a regular expression to force a match of closing parentheses specifically in the number of the opening parentheses? For example, if the string is "((foo bar))", I want to be able to say "match any number of... (7 Replies)
Discussion started by: cvp
7 Replies

5. Shell Programming and Scripting

How to insert Parentheses to each line in a file

Hi I have a file with numbers like this : 123 456 6798 9073233 12 8644 Now, I need to insert parentheses to each and every line like below : (123) (456) (6798) (9073233) (12) (8644) can anyone tell me a solution? (8 Replies)
Discussion started by: sudharsan23
8 Replies

6. UNIX for Dummies Questions & Answers

Replace all occurrences of strings with parentheses

Hi, I tried to adapt bartus's solution to my problem, without success. I want to replace all the occurences of this: with: , where something can contain an arbitrary number of balanced parens and brakets. Any ideas ? Best, (1 Reply)
Discussion started by: ff1969ff1969
1 Replies

7. Shell Programming and Scripting

Rules with using double parentheses in Bash

Hi.could you explain me what are the rules when we are using double parentesis in if statement,if I put ,the code is working ,with (( is not #!/bin/bash if (($# > 0)) then if ((! -d "$1")) then echo "Directory $1 not found" fi else echo Problem fi (8 Replies)
Discussion started by: lio123
8 Replies

8. Shell Programming and Scripting

When does an if statement need parentheses

I was looking at a script in my little book on bash and saw that one of the if statements had parentheses instead of brackets for the condition. I've been trying to find in my book where it talks about parentheses (because the examples on the if statement in an earlier chapter doesn't seem to... (3 Replies)
Discussion started by: Straitsfan
3 Replies

9. Shell Programming and Scripting

Help with extracting data within parentheses

This is my input file: a|b|c(ef)|g|h(km)|p My output file should look like: a|b|ef|g|km|p That is, pipe is the delimiter. The data within pipe must be displayed as it is but if it encounters any data within parentheses, then only the data within parentheses has to be displayed ( the data... (2 Replies)
Discussion started by: ksatish89
2 Replies

10. Shell Programming and Scripting

[All variants] remove first pair of parentheses

How to remove first pair of parentheses and content in them from the beginning of the line? Here's the list: (ok)-test (ok)-test-(ing) (some)-test-(ing)-test test-(ing) Desired result: test test-(ing) test-(ing)-test test-(ing) Here's what I already tried with GNU sed: sed -e... (6 Replies)
Discussion started by: useretail
6 Replies
Locale::Codes::LangVar(3pm)				 Perl Programmers Reference Guide			       Locale::Codes::LangVar(3pm)

NAME
Locale::Codes::LangVar - standard codes for language variation identification SYNOPSIS
use Locale::Codes::LangVar; $lvar = code2langvar('acm'); # $lvar gets 'Mesopotamian Arabic' $code = langvar2code('Mesopotamian Arabic'); # $code gets 'acm' @codes = all_langvar_codes(); @names = all_langvar_names(); DESCRIPTION
The "Locale::Codes::LangVar" module provides access to standard codes used for identifying language variations, such as those as defined in the IANA language registry. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default IANA language registry codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language variations. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lvar = code2langvar('en','alpha-2'); $lvar = code2langvar('en',LOCALE_CODE_ALPHA_2); The codesets currently supported are: alpha This is the set of alphanumeric codes from the IANA language registry, such as 'arevela' for Eastern Armenian. This code set is identified with the symbol "LOCALE_LANGVAR_ALPHA". This is the default code set. ROUTINES
code2langvar ( CODE [,CODESET] ) langvar2code ( NAME [,CODESET] ) langvar_code2code ( CODE ,CODESET ,CODESET2 ) all_langvar_codes ( [CODESET] ) all_langvar_names ( [CODESET] ) Locale::Codes::LangVar::rename_langvar ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangVar::add_langvar ( CODE ,NAME [,CODESET] ) Locale::Codes::LangVar::delete_langvar ( CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_alias ( NAME ,NEW_NAME ) Locale::Codes::LangVar::delete_langvar_alias ( NAME ) Locale::Codes::LangVar::rename_langvar_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::delete_langvar_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.iana.org/assignments/language-subtag-registry The IANA language subtag registry. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2012 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.2 2012-10-11 Locale::Codes::LangVar(3pm)
All times are GMT -4. The time now is 11:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy