Sponsored Content
Top Forums Shell Programming and Scripting How to read all data after a specific string from a text file ? Post 302928510 by Monoj2014 on Friday 12th of December 2014 08:50:38 AM
Old 12-12-2014
How to read all data after a specific string from a text file ?

Hi,

I have a file(input.txt) and trying to format as output.txt. See the attached file format.

Note: This is a windows file (DOS format) and the commands are also going to execute on windows.

Basically I am trying to capture all the data in between Local Group Memberships and Global Group Memberships. Then remove unnecessary strings like * from beginning of each string.

Thanks!!!
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

read specific text from a log file

Hi guys I need to retrieve the values in BOLD that I have mentioned in the below log file. I want to store those values in a variable, preferably the same name as the column name in the log file. if you paste the below mentioned log file in a notepad and remove the word wrap.. u will get a... (4 Replies)
Discussion started by: ragha81
4 Replies

2. Shell Programming and Scripting

read space filled file and replace text at specific position

Hi I have a spaced filled file having records like below: What I want is to read line having RT3 at position 17-19 then go to position 2651 check the 18 characters (might be space filled till 18 characters). This position should have a... (6 Replies)
Discussion started by: COD
6 Replies

3. Shell Programming and Scripting

Reading data from a specific line in a text file

hello, I have got the following problem that I am hoping someone can help with please. 1. I have got the following text file (below) , the columns data are 'Test Day', 'Board', 'Betting Number'. TEXT FILE ============================================ 1 3 02-01-27-28-29-30 0 1... (1 Reply)
Discussion started by: jermaine4ever
1 Replies

4. Shell Programming and Scripting

Reading data from a specific line in a text file

Hello, I have a problem which is giving me headache for days, can some please help. Please see code and text fiel below. Please see text in red for the problem I am facing # Program gets an input x from user while read line ; do echo... (4 Replies)
Discussion started by: jermaine4ever
4 Replies

5. Shell Programming and Scripting

Read Write byte range/chunk of data from specific location in file

I am new to Unix so will really appreciate if someone can guide me on this. What I want to do is: Step1: Read binary file - pick first 2 bytes, convert from hex to decimal. Read the next 3 bytes as well. 2 bytes will specify the number of bytes 'n' that I want to read and write... (1 Reply)
Discussion started by: Kbenipel
1 Replies

6. Shell Programming and Scripting

read data from file from a specific duration

Hi, i have log file which keeps on updating almost ever minute but i have certain string in log which will only be displayed between specific time. so i need to search for that string and copy the details starting from that string and stop at certain string below that. example: log file... (2 Replies)
Discussion started by: gpk_newbie
2 Replies

7. Shell Programming and Scripting

how read specific line in a file and write it in a new text file?

I have list of files in a directory 'dir'. Each file is of type HTML. I need to read each file and get the string which starts with 'http' and write them in a new text file. How can i do this shell scripting? file1.html <head> <url>http://www.google.com</url> </head> file2.html <head>... (6 Replies)
Discussion started by: vel4ever
6 Replies

8. Windows & DOS: Issues & Discussions

Removing anything from text file except specific string

So, I have a text file that looks like this: 0,0: (168,168,176) #A8A8B0 srgb(168,168,176) 1,0: (168,168,176) #A8A8B0 srgb(168,168,176) 2,0: (166,166,174) #A6A6AE srgb(166,166,174) 3,0: (166,166,174) #A6A6AE srgb(166,166,174) 4,0: (168,168,176) #A8A8B0 srgb(168,168,176) 5,0:... (0 Replies)
Discussion started by: pasc
0 Replies

9. Shell Programming and Scripting

How to read data from tab delimited file after a specific position?

Hi Experts, I have a tab deliminated file as below myfile.txt Local Group Memberships *Administrators *Guests I need data in below format starting from 4th position. myfile1.txt Administrators Guests the above one is just an example and there could... (15 Replies)
Discussion started by: Litu1988
15 Replies
SPLFILEOBJECT.FSCANF(3) 						 1						   SPLFILEOBJECT.FSCANF(3)

SplFileObject::fscanf - Parses input from file according to a format

SYNOPSIS
public mixed SplFileObject::fscanf (string $format, [mixed &$...]) DESCRIPTION
Reads a line from the file and interprets it according to the specified $format, which is described in the documentation for sprintf(3). Any whitespace in the $format string matches any whitespace in the line from the file. This means that even a tab in the format string can match a single space character in the input stream. PARAMETERS
o $format - The specified format as described in the sprintf(3) documentation. o $... - The optional assigned values. RETURN VALUES
If only one parameter is passed to this method, the values parsed will be returned as an array. Otherwise, if optional parameters are passed, the function will return the number of assigned values. The optional parameters must be passed by reference. EXAMPLES
Example #1 SplFileObject::fscanf example <?php $file = new SplFileObject("misc.txt"); while ($userinfo = $file->fscanf("%s %s %s")) { list ($name, $profession, $countrycode) = $userinfo; // Do something with $name $profession $countrycode } ?> Contents of users.txt javier argonaut pe hiroshi sculptor jp robert slacker us luigi florist it SEE ALSO
fscanf(3). PHP Documentation Group SPLFILEOBJECT.FSCANF(3)
All times are GMT -4. The time now is 08:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy