Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Extract a portion of string from each line in Linux Post 303017642 by rkakitapalli on Saturday 19th of May 2018 03:14:56 PM
Old 05-19-2018
Thanks Rudic this really serves my purpose. I have just one more question. If I want to grep for multiple keywords in each line . Lets say in this case we picked the field "destination" Along with this If we want to collect the field "delete".

Expected output for same input:

Code:
1|"destinationPath":"/cd/rest/stone/data","delete":true
 20|"destinationPath":"/ab/test/rock/archive","delete":true



Moderator's Comments:
Mod Comment Seriously: Please use CODE tags as required by forum rules!

Last edited by RudiC; 05-19-2018 at 04:34 PM.. Reason: Added CODE tags.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to extract a portion of a string from the whole string

How to extract a portion of a string from a full string using unix. For example: Say source string is = "req92374923.log" I want only the numeric portion of the string say "92374923" how to do that in Unix. (2 Replies)
Discussion started by: ds_sastry
2 Replies

2. Shell Programming and Scripting

extract a portion of log file

hello, I want to grep the log file according to time and get the portion of log from one particular time to other. I can grep for individual lines by time but how should I print lines continuously from given start time till end till given end time. Appreciate your ideas, Thanks chandra (8 Replies)
Discussion started by: chandra004
8 Replies

3. Shell Programming and Scripting

extract date portion from file

Hi, I have a file where there is a date field (single line variable length file) how to extract just the date portion from it the position of date field may vary anywhere in the line but will always have the format mm-dd-yyyy for eg . xxxxxxxxxxxxxxx09-10-2006xxxxxxxxxxxxxxxxxxxx (5 Replies)
Discussion started by: misenkiser
5 Replies

4. Shell Programming and Scripting

how to extract a string value from the given line

Hi I have an input as follows: param1:value1|param2:value2|param3:value3|param4:value4|param5:value5 where, "|" and ":" are delimiters Now suppose, I want to extract the value corresponding to "param4", i.e. "value4" in this case. In case we use awk, I want to use the value in shell... (1 Reply)
Discussion started by: gaurav_1711
1 Replies

5. Shell Programming and Scripting

extract string portion using sed

Hi All I have 3 files as listed below and highlighted in bold the portions of the filenames I need to extract: TOS_TABIN218_20090323.200903231830 TOS_TABIN219_1_20090323.200903231830 TOS_TABIN219_2_20090323.200903231830 I tried source_tabin_name=`echo $fname | sed 's/_.*//'` but I... (6 Replies)
Discussion started by: santam
6 Replies

6. Shell Programming and Scripting

extract string portion from filename using sed

Hi All, I posted something similar before but I now have a another problem. I have filenames as below TOP_TABIN240_20090323.200903231830 TOP_TABIN235_1_20090323.200903231830 i need to extract the dates as in bold. Using bash v 3.xx Im trying to using the print sed command but... (11 Replies)
Discussion started by: santam
11 Replies

7. Shell Programming and Scripting

How to extract a text portion from a file

Can some one help me with shell script to extract a text block between two known strings. The given input file is as below: Name: abs Some tesxt.... Some tesxt.... Some tesxt.... end of text Name: xyz Some tesxt.... Some tesxt.... Some tesxt.... end of text Name: efg Some... (5 Replies)
Discussion started by: ejazs0
5 Replies

8. Shell Programming and Scripting

Extract a string from a line

Hiee all Can anyone tell me how to extract a string from a given line. STAPISDK_RELEASE_32_BL012_2011_JAN_25.1597 I want to extract BL012 from above. as 102 keeps on changing i want smthing like that it extract BL and 102 extrct by its own. Thankx guyzz (9 Replies)
Discussion started by: abhijtr
9 Replies

9. Shell Programming and Scripting

How to extract portion of a string?

Hi Gurus, Would like to seek some help on how to extract a portion of string from log's output as shown below. Sample of raw data: piece handle=/test123/disk_dump/test123/df0_cntrl_PCPFCI20120404_68498 tag=TAG20120404T180035 comment=NONE piece... (13 Replies)
Discussion started by: superHonda123
13 Replies

10. Shell Programming and Scripting

Extract portion of data

Hi Gurus, I need some help in extracting some of these information and massage it into the desired output as shown below. I need to extract the last row with the header in below sample which is usually the most recent date, for example: 2012-06-01 142356 mb 519 -219406 mb 1 ... (9 Replies)
Discussion started by: superHonda123
9 Replies
The object management API.(3)					      libmtp					     The object management API.(3)

NAME
libmtp - The object management API. Functions int LIBMTP_Delete_Object (LIBMTP_mtpdevice_t *, uint32_t) int LIBMTP_Set_Object_Filename (LIBMTP_mtpdevice_t *, uint32_t, char *) Detailed Description Function Documentation int LIBMTP_Delete_Object (LIBMTP_mtpdevice_t *device, uint32_tobject_id) This function deletes a single file, track, playlist, folder or any other object off the MTP device, identified by the object ID. If you delete a folder, there is no guarantee that the device will really delete all the files that were in that folder, rather it is expected that they will not be deleted, and will turn up in object listings with parent set to a non-existant object ID. The safe way to do this is to recursively delete all files (and folders) contained in the folder, then the folder itself. Parameters: device a pointer to the device to delete the object from. object_id the object to delete. Returns: 0 on success, any other value means failure. References LIBMTP_mtpdevice_struct::params. int LIBMTP_Set_Object_Filename (LIBMTP_mtpdevice_t *device, uint32_tobject_id, char *newname) THIS FUNCTION IS DEPRECATED. PLEASE UPDATE YOUR CODE IN ORDER NOT TO USE IT. See Also: LIBMTP_Set_File_Name() LIBMTP_Set_Track_Name() LIBMTP_Set_Folder_Name() LIBMTP_Set_Playlist_Name() LIBMTP_Set_Album_Name() References LIBMTP_file_struct::filetype, and LIBMTP_Get_Filemetadata(). Author Generated automatically by Doxygen for libmtp from the source code. Version 1.1.3 Sun Feb 17 2013 The object management API.(3)
All times are GMT -4. The time now is 10:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy