Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Using sed to change lines and add them if they don't exist.. Post 302639649 by Scrutinizer on Saturday 12th of May 2012 12:28:48 PM
Old 05-12-2012
Hi, this:
Code:
sed 's/^ro.ril.gprsclass=*/ro.ril.gprsclass=12/g' /system/build.prop

should be this:
Code:
sed 's/^ro\.ril\.gprsclass=.*/ro.ril.gprsclass=12/g' /system/build.prop

probably your busybox version of sed has a -i option so the file can be edited in-place..

I don't think you need to use "busybox echo" since echo is a shell built-in

for grep I would you "grep -q"

Last edited by Scrutinizer; 05-12-2012 at 01:34 PM..
This User Gave Thanks to Scrutinizer For This Post:
 

9 More Discussions You Might Find Interesting

1. Solaris

Change password - User does not exist

When trying to change the password with the command "passwd" it returns that the user does not exist. passwd <USER> passwd: changing password for <USER> passwd: <USER> does not exist This is a Solaris 2.5.1 system. (7 Replies)
Discussion started by: ryamada
7 Replies

2. Shell Programming and Scripting

Sed Add New Lines

Hello, I have a file that has data like this: one two three four five six seven eight nine ten Is there a quick way using sed of nawk to put each word on it's own line? Thanks. (2 Replies)
Discussion started by: bestbuyernc
2 Replies

3. Shell Programming and Scripting

Sed insert and Change lines help needed

Hi, How can i use insert and change command in ksh shell. I am using : sed -e '1i\TEXTTOBEINSERTED\' FILENAME But there is no effect... Also sed -e 'c\thisischange\' Filename Please Explain how to proceed?? (2 Replies)
Discussion started by: JunkYardWars
2 Replies

4. Shell Programming and Scripting

Add lines with sed or awk

I want to get an output from the input as below: Input: ASDDS14 RXOTX-39-8 AB0991C TRY1900 AEDFS12 RXOTX-39-9 TK0991C TRY800 HSVDS11 RXOTX-389-10 LG0991C TRY1900 BSDDS09 RXOTX-394-0 AA0066A TRY800 OUTPUT: ASDDS14 RXOTS-39-8-0 AB0991C TRY1900... (2 Replies)
Discussion started by: aydj
2 Replies

5. Shell Programming and Scripting

How to use sed command for change special lines?

Hi, I want to add a character "#" in this few lines with sed command Initial: ### CACCIA: DEBUT ### if $(grep -wqi "$2" /etc/passwd); then chuser -R files registry=files $2 fi ### CACCIA: FIN ### Result with sed command: ### CACCIA: DEBUT ### #if $(grep -wqi "$2"... (4 Replies)
Discussion started by: khalidou13
4 Replies

6. Shell Programming and Scripting

Remove words from file2 that don't exist in file1

Hi I have to list of words file1 and file2, I want to compare both lists and remove from file2 all the words that don't exist in file1. How can I do this? Many thanks (4 Replies)
Discussion started by: noliveira
4 Replies

7. UNIX for Dummies Questions & Answers

Change unix permission when I don't own the file

Hi, A file is transferred from a Windows server(say username : user1) to Unix server via ftp. In unix, the permission of the file for a user, say user2 will be "-rw-r-----". Since the user1 is the owner of the file, user2 is not able to change the file permission using chmod. Is there... (5 Replies)
Discussion started by: merin
5 Replies

8. Shell Programming and Scripting

Add character to specific columns using sed or awk and make it a permanent change

Hi, I am writing a shell script where I want that # should be added in all those lines as the first character where the pattern matches. file has lot of functions defined a.sh #!/bin/bash fn a { beautiful evening sunny day } fn b { } fn c { hello world .its a beautiful day ... (12 Replies)
Discussion started by: ashima jain
12 Replies

9. Shell Programming and Scripting

Add string into certain lines - sed

Hello all, I have surely an easy question - but at the moment I do not see the solution. All what I want is to add the string "/9201" within a file when a line starts with ":47A:". This is how a file look like: Information Tool :12:Delimiter :3:Space :47A:0329 :3:Space After the... (2 Replies)
Discussion started by: API
2 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 10:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy