Sponsored Content
Top Forums UNIX for Dummies Questions & Answers problem with extracting line in file Post 302707045 by Alyssa on Thursday 27th of September 2012 11:53:11 PM
Old 09-28-2012
Power problem with extracting line in file

My file looks like this and i need to only extract those with PDT_AP21_B and output it to another file. Can anyone help? Thanks.

Code:
PDT_AP21_R,,,        11        TYS,,,,T17D1207230742TYO***T17DS,,C
PDT_AP21_L,,,9631166650001        ,,,,T17D1207230903TYOTYST17DS       ,,C
PDT_AP21_B,TYOTYST17DS,T17DC120723,N


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data.

Last edited by vbe; 09-28-2012 at 05:37 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extracting specified line from a file using awk

Hi, I am just trying to extract a line at a time from a file using awk and can't yet extract even the first line using the following:- awk '/(^) && (NR==1)/ {print $1}' file1 Is there an obvious silly error here? Thanks (3 Replies)
Discussion started by: sirtrancealot
3 Replies

2. Shell Programming and Scripting

Extracting a line in a text file

If my file looks like this…. 10 20 30 and I want to take each line individually and put it in a variable so it can be read later in it's on individual test statement, how can I do that? I guess what I'm asking is how can I extract each line individually. Thanks (5 Replies)
Discussion started by: terryporter51
5 Replies

3. UNIX for Dummies Questions & Answers

Help: Sorting and extracting a line from a file

I was proposed with the following problem: The file 'numbers' contains a list of numbers. Write a command to place the largest one of those numbers in the file 'largest' (there should be nothing else in that file). Do not use the 'head' command in your answer. I think if i used the sort... (1 Reply)
Discussion started by: stava
1 Replies

4. Shell Programming and Scripting

Extracting line from a file

Hi, I would like to extract a certain portion of sentences from a particular sentence i.e. to extract the last section embrace by input output Please advice. Cheers (6 Replies)
Discussion started by: dwgi32
6 Replies

5. Shell Programming and Scripting

[Solved] Problem in reading a file line by line till it reaches a white line

So, I want to read line-by-line a text file with unknown number of files.... So: a=1 b=1 while ; do b=`sed -n '$ap' test` a=`expr $a + 1` $here do something with b etc done the problem is that sed does not seem to recognise the $a, even when trying sed -n ' $a p' So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies

6. Shell Programming and Scripting

extracting line numbers from a file and redirecting them to another file

i have applied the following command on a file named unix.txt that contains the string "linux from the text" grep -n -i -w "linux from the text" unix.txt and the result is 5:Today's Linux from the text systems are split into various branches, developed over time by AT&T as well as various... (5 Replies)
Discussion started by: arindamlive
5 Replies

7. Shell Programming and Scripting

error while extracting a line from a file based on identifier

here is the content of input file CREATE TABLE `bla bla bla` ( `allianceSiteId` int(11) DEFAULT NULL, `trunkGroupsId` int(11) DEFAULT NULL, `lastModified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, UNIQUE KEY `allianceSiteId`... (4 Replies)
Discussion started by: vivek d r
4 Replies

8. UNIX for Dummies Questions & Answers

Extracting line1 from a file with certain file pattern in line 7

Hello there, I am new to unix and would like to do the following, hoping someone would give some guide, thanks in advance. Lets say i have a file like this: A w x y w x 0.1 B w x y w x 0.3 C w x y w x 0.7 D w x y w x 0.9 E w x y w x 0.2 So i would like to extract line 1 data where line... (2 Replies)
Discussion started by: seiksoon
2 Replies

9. UNIX for Dummies Questions & Answers

Extracting lines from a text file based on another text file with line numbers

Hi, I am trying to extract lines from a text file given a text file containing line numbers to be extracted from the first file. How do I go about doing this? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies

10. Shell Programming and Scripting

Problem extracting zipped tar file

I was extracting the zipped tar file with the command gzip -dc Sample.tar.gz |tar xf - The tar file contained many delimited files; but lately they changed the structure of the tar file with another folder. So now all the delimited files are inside a folder called "Folder1" and the folder... (6 Replies)
Discussion started by: asandy1234
6 Replies
CABEXTRACT(1)						      General Commands Manual						     CABEXTRACT(1)

NAME
cabextract - program to extract files from Microsoft cabinet (.cab) archives SYNOPSIS
cabextract [-ddir] [-f] [-Fpattern] [-h] [-l] [-L] [-p] [-q] [-s] [-t] [-v] cabinet files ... DESCRIPTION
cabextract is a program that un-archives files in the Microsoft cabinet file format (.cab) or any binary file which contains an embedded cabinet file (frequently found in .exe files). cabextract will extract all files from all cabinet files specified on the command line. To extract a multi-part cabinet consisting of several files, only the first cabinet file needs to be given as an argument to cabextract as it will automatically look for the remaining files. To prevent cabextract from extracting cabinet files you did not specify, use the -s option. OPTIONS
A summary of options is included below. -d dir Extracts all files into the directory dir. -f When testing or extracting cabinet files, corrupted MSZIP blocks will be ignored. A warning will be printed if a corrupted MSZIP block is encountered. -F pattern Only files with names that match the shell pattern pattern shall be listed, tested or extracted. On non-GNU systems, this match may be case-sensitive. -h Prints a page of help and exits. -l Lists the contents of the given cabinet files, rather than extracting them. -L When extracting cabinet files, makes each extracted file's name lowercase. -p Files shall be extracted to standard output. -q When extracting cabinet files, suppresses all messages except errors and warnings. -s When testing, listing or extracting cabinets which span multiple files, only cabinet files given on the command line shall be used. -t Tests the integrity of the cabinet. Files are decompressed, but not written to disk or standard output. If the file successfully decompresses, the MD5 checksum of the file is printed. -v If given alone on the command line, prints the version of cabextract and exits. Given with a list of cabinet files, it will list the contents of the cabinet files. AUTHOR
This manual page was written by Stuart Caie <kyzer@4u.net>, based on the one written by Eric Sharkey <sharkey@debian.org>, for the Debian GNU/Linux system. SEE ALSO
lcab(1) October 30, 2005 CABEXTRACT(1)
All times are GMT -4. The time now is 11:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy