Sponsored Content
Full Discussion: Edit variable in a file
Top Forums Shell Programming and Scripting Edit variable in a file Post 302799687 by FD1999 on Saturday 27th of April 2013 07:46:17 AM
Old 04-27-2013
Question Edit variable in a file

Hello,
I have a script which reads variable values from /system/pt.conf
I sourced it already.

But the probelm is I don't know how to edit only the value from the variable "res" in the conf file.

pt.conf:
Code:
res=1280x720
log=1

And I want to edit the value "1280x720" from "res".

I was trying
Code:
sed -i 's/$res/320x480/g' /system/pt.conf

But it didn't worked. Still the same value.

Last edited by Scrutinizer; 04-27-2013 at 09:04 AM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

file name edit

ok I have a list of files for example: 130-4-32.HindIII.0.ids 130-4-32.HindIII.0.ppm 130-4-32.HindIII.0.ppm.gz 130-4-33.HindIII.0.bands 130-4-33.HindIII.0.ics 130-4-33.HindIII.0.ids 130-4-33.HindIII.0.ppm 130-4-33.HindIII.0.ppm.gz 130-4-34.HindIII.0.bands ... (1 Reply)
Discussion started by: lorcet222
1 Replies

2. Shell Programming and Scripting

file edit help

Hi, Could anyone give me a idea how to strip the lines from a given file. example *********** 1st occurence 1st occurence 1st occurence 1st occurence *********** 2nd occurence 2nd occurence 2nd occurence 2nd occurence 2nd occurence 2nd occurence ************* 3rd occurence 3rd... (10 Replies)
Discussion started by: sentak
10 Replies

3. Shell Programming and Scripting

Edit value in File

I have a file oratab with entry like this SCADAG:/esitst1/oracle/product/9.2.0.8:Y I am trying to discover a way to change the 9.2.0.8 part of this to something like 10.2.0.4 as part of an upgrade script. I have tried cat /etc/oratab >>/tmp/oratab... (1 Reply)
Discussion started by: sewood
1 Replies

4. Shell Programming and Scripting

In bash, read to a variable with a default value to edit

My script needs to read a variable from the user. But before the user types the input, I want to give a default value so the user can edit the default value for input. How can I implement it? My script is something like: #!/bin/sh read -p 'Port number: ' -e port_number echo "Port... (7 Replies)
Discussion started by: pankai
7 Replies

5. Shell Programming and Scripting

Quick edit on accepted variable.

I am new newbie to unix. I am taking user input using ksh script. The valid value user can enter is a) Numeric 1 to 500 b) character e, r c) e1 to e100 I figured out how to deal with a) and b) but want to separate characters when user enter e1 to e100 I want to store e in... (1 Reply)
Discussion started by: ekb
1 Replies

6. Shell Programming and Scripting

Script to Edit the file content and create new file

I have a requirement, which is as follows *. Folder contains list of xmls. Script has to create new xml files by copying the existing one and renaming it by appending "_pre.xml" at the end. *. Each file has multiple <Name>fileName</Name> entry. The script has to find the first occurance of... (1 Reply)
Discussion started by: sudesh.ach
1 Replies

7. Shell Programming and Scripting

Edit a file

I have file like cp -p /var/adm/ /tmp1/tmp1.log cp -p /var/adm/ /tmp1/tmp2.log cp -p /var/adm/ /tmp1/tmp3.log cp -p /var/adm/ /tmp1/tmp4.log I need to re-write the file like: cp -p /var/adm/tmp1.log /tmp1/ cp -p /var/adm/tmp2.log /tmp1/ cp -p /var/adm/tmp3.log /tmp1/ cp -p... (3 Replies)
Discussion started by: h_banka
3 Replies

8. Shell Programming and Scripting

edit file

I have a file containing dates like below 2010 1 02 2010 2 01 2010 3 05 i want the dates to be like below 20100102 20100201 20100305 i tired using awk '{printf "%s%02s%02s",$1,$2,$3}' But it does not work,it puts all the dates in one line,i want them in seperate lines like the... (6 Replies)
Discussion started by: tomjones
6 Replies

9. Shell Programming and Scripting

How to edit specific variable in file?

HI guys i have a question. Question 1: how do i modify a particular string? e.g echo "Please enter Book Title: " read a echo "Please enter Author: " read b if ] then echo " Record found!" which will then pop out a menu with the follow output 1. Update Name 2.... (1 Reply)
Discussion started by: ichar
1 Replies

10. Shell Programming and Scripting

ksh script trying to pass a variable to edit a file

I'm trying to create a ksh script that will ask the user for the port number. $PORT1 is the variable I want to use that will contain whatever numbers the user inputs. The script would edit ports.txt file, search and delete "./serv 110.1.0.1.$PORT1 200;=3" . So if the user types 50243 then the... (5 Replies)
Discussion started by: seekryts15
5 Replies
ojo(3pm)						User Contributed Perl Documentation						  ojo(3pm)

NAME
ojo - Fun Oneliners with Mojo! SYNOPSIS
$ perl -Mojo -E 'say g("mojolicio.us")->dom->at("title")->text' DESCRIPTION
A collection of automatically exported functions for fun Perl oneliners. Ten redirects will be followed by default, you can change this behavior with the "MOJO_MAX_REDIRECTS" environment variable. $ MOJO_MAX_REDIRECTS=0 perl -Mojo -E 'say g("mojolicio.us")->code' Proxy detection is enabled by default, but you can disable it with the "MOJO_PROXY" environment variable. $ MOJO_PROXY=0 perl -Mojo -E 'say g("mojolicio.us")->body' FUNCTIONS
ojo implements the following functions. "a" my $app = a('/' => sub { shift->render(json => {hello => 'world'}) }); Create a route with "any" in Mojolicious::Lite and return the current Mojolicious::Lite object. See also the Mojolicious::Lite tutorial for more argument variations. $ perl -Mojo -E 'a("/" => {text => "Hello Mojo!"})->start' daemon "b" my $stream = b('lalala'); Turn string into a Mojo::ByteStream object. $ perl -Mojo -E 'b(g("mojolicio.us")->body)->html_unescape->say' "c" my $collection = c(1, 2, 3); Turn list into a Mojo::Collection object. "d" my $res = d('mojolicio.us'); my $res = d('http://mojolicio.us' => {DNT => 1} => 'Hi!'); Perform "DELETE" request with "delete" in Mojo::UserAgent and return resulting Mojo::Message::Response object. "f" my $res = f('http://kraih.com' => {a => 'b'}); my $res = f('kraih.com' => 'UTF-8' => {a => 'b'} => {DNT => 1}); Perform "POST" form request with "post_form" in Mojo::UserAgent and return resulting Mojo::Message::Response object. "g" my $res = g('mojolicio.us'); my $res = g('http://mojolicio.us' => {DNT => 1} => 'Hi!'); Perform "GET" request with "get" in Mojo::UserAgent and return resulting Mojo::Message::Response object. "h" my $res = h('mojolicio.us'); my $res = h('http://mojolicio.us' => {DNT => 1} => 'Hi!'); Perform "HEAD" request with "head" in Mojo::UserAgent and return resulting Mojo::Message::Response object. "o" my $res = o('mojolicio.us'); my $res = o('http://mojolicio.us' => {DNT => 1} => 'Hi!'); Perform "OPTIONS" request with "options" in Mojo::UserAgent and return resulting Mojo::Message::Response object. "p" my $res = p('mojolicio.us'); my $res = p('http://mojolicio.us' => {DNT => 1} => 'Hi!'); Perform "POST" request with "post" in Mojo::UserAgent and return resulting Mojo::Message::Response object. "t" my $res = t('mojolicio.us'); my $res = t('http://mojolicio.us' => {DNT => 1} => 'Hi!'); Perform "PATCH" request with "patch" in Mojo::UserAgent and return resulting Mojo::Message::Response object. "u" my $res = u('mojolicio.us'); my $res = u('http://mojolicio.us' => {DNT => 1} => 'Hi!'); Perform "PUT" request with "put" in Mojo::UserAgent and return resulting Mojo::Message::Response object. "x" my $dom = x('<div>Hello!</div>'); Turn HTML5/XML input into Mojo::DOM object. $ perl -Mojo -E 'say x("<div>Hello!</div>")->at("div")->text' SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 ojo(3pm)
All times are GMT -4. The time now is 08:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy