Sponsored Content
Top Forums Shell Programming and Scripting Extract a value using sed (easy) Post 302938951 by jcanale on Friday 20th of March 2015 08:24:03 AM
Old 03-20-2015
Extract a value using sed (easy)

I have this command to replace the version value from PROGRAM (for example here PROGRAM == player) by NEWVERSION

Code:
sed "/^ *$PROGRAM:/{N; s/[^:]*$/ $NEWVERSION/;}" -i $PRDFILE

Code:
  player:
    version: V6R2013xD3HF5v1
  player_old:
    version: V6R2013xD3HF5v1
  partchecker:
    version: 6.142.1-rc6

But now, I would like just extract PROGRAM Version without replacing the string.
(Just get V6R2013xD3HF5v1 if program == player)

Thank you for your help
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Please help! Sed extract a pattern

I am trying to extract "securitySettings" out of line: <a ref ="http://localhost:5654/securitySettings"> using sed as follows: name = `grep "localhost" file.html | sed -n 's/.**\/\(.*)/\">/\1/p'` But it didn't run, seems have some syntax error. Do anybody knows why? Thank you very... (11 Replies)
Discussion started by: zhen
11 Replies

2. UNIX for Dummies Questions & Answers

Easy sed question?

I have a line like: "Jun 19 12:56:22 routername 45454:" I want to keep all information except the seconds of the time. I tried: sed 's/..:..:../..:../g' but apparently I'm on the wrong track, because although that matches on the time, it replaces it with the literal ..:.. How... (6 Replies)
Discussion started by: earnstaf
6 Replies

3. UNIX for Dummies Questions & Answers

Need help on installing an EASY to use and easy to install command line text editor

Hi again. Sorry if it seems like I'm spamming the boards a bit, but I figured I might as well ask all the questions I need answers to at once, and hopefully at least get some. I have installed Solaris 10 on a server. The default text editors are there (vi, ex, ed, maybe others, I know emacs is... (4 Replies)
Discussion started by: EugeneG
4 Replies

4. Shell Programming and Scripting

SED to extract characters

Hi, Please let me know how do we write a piece of code to extract characters from a line using SED. (2 Replies)
Discussion started by: Shilpi
2 Replies

5. Shell Programming and Scripting

Easy unix/sed question that I could have done 10 years ago!

Hi all and greetings from Ireland! I have not used much unix or awk/sed in years and have forgotten a lot. Easy enough query tho. I am cleansing/fixing 10,000 postal addresses using global replacements. I have 2 pipe delimited files , one is basically a spell checker for geographical... (4 Replies)
Discussion started by: dewsbury
4 Replies

6. Shell Programming and Scripting

Extract word using sed

Hello, I am new to sed and am trying to extract a word using sed. for example i have a line "const TotalAmount& getTotalAmount() const; " in the file test.txt I am trying to extract getTotalAmount() from the line. For this i tried cat test.txt | sed -n 's/.*get*\(\)//p But... (8 Replies)
Discussion started by: prasbala
8 Replies

7. Shell Programming and Scripting

Extract using sed

Given a file with contents /arch/powerpc/boot/4xx.o > /arch/powerpc/boot/.4xx.o.cmd > /arch/powerpc/boot/addnote 5766a5769 > /arch/powerpc/boot/.addnote.cmd 5768a5772,5773 > /arch/powerpc/boot/bamboo.o > /arch/powerpc/boot/.bamboo.o.cmd 5769a5775,5778 > /arch/powerpc/boot/cpm-serial.o... (8 Replies)
Discussion started by: xerox
8 Replies

8. Shell Programming and Scripting

sed data extract

Hello, I have huge number files in a directory. All files have the data. I want extract data. I want all output write to single csv file. following codes works. Thank you very much for help. sed -n '/.*Content$txtE_Zip" type="text" value="\(*\)" maxlength.*/s//\1/p' *>file1 sed -n... (5 Replies)
Discussion started by: hoo
5 Replies

9. Shell Programming and Scripting

sed to extract all strings

Hi, I have a text file containing 2 lines as follows: I'm trying to extract all the strings following an "AME." The output would be as follows: BUSINESS_UNIT PROJECT_ID ACTIVITY_ID RES_USER1 RESOURCE_ID_FROM ANALYSIS_TYPE BI_DISTRIB_STATUS BUSINESS_UNIT PROJECT_ID ACTIVITY_ID... (5 Replies)
Discussion started by: simpletech369
5 Replies

10. Shell Programming and Scripting

Couple of easy questions for experts on awk/sed

Hello Experts.. I have 3-4 C codes with Oracle SQL statements embedded. All the SQL statements starts with EXEC SQL keyword and ends with ;. I want to extract all the SQL statements out of these codes. I did awk '/^EXEC SQL/,/\;/' inputFile (I use this on all of the codes individually). That... (2 Replies)
Discussion started by: juzz4fun
2 Replies
SYNCE-REMOVE-PROGRAM(1) 				   http://synce.sourceforge.net/				   SYNCE-REMOVE-PROGRAM(1)

NAME
synce-remove-program - removes a program from your device SYNOPSIS
synce-remove-program [-d LEVEL] [-p device_path] [-o UNLOAD_OPT] NAME ... DESCRIPTION
synce-remove-program removes a program on a device connected through SynCE. OPTIONS
-d LEVEL Set debug log level: 0 - No logging (default) 1 - Errors only 2 - Errors and warnings 3 - Everything -p PATH Path to device -h Display help message. -o UNLOAD_OPT Flags to pass to unload.exe on the remote device. Currently no flags are known, but this flag is here in case we find some. NAME The name of the program on the device. Program names are in the form "Provider Program". This is the same way the name will appear under Settings -> Remove programs on your device, or in the ouput from synce-list-programs. AUTHOR
David Eriksson <twogood@users.sourceforge.net>. SEE ALSO
synce(1) synce-list-programs(1) synce-install-cab(1) prun(1) The SynCE project November 2002 SYNCE-REMOVE-PROGRAM(1)
All times are GMT -4. The time now is 11:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy