Sponsored Content
Top Forums Shell Programming and Scripting extract nth line of all files and print in output file on separate lines. Post 302435336 by bartus11 on Wednesday 7th of July 2010 05:34:27 AM
Old 07-07-2010
It seems like homework... but anyway:
Code:
awk 'FNR==45678{print $0,FILENAME}' *.txt > output.txt

This User Gave Thanks to bartus11 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract x lines after a pattern - place each result in separate file

Hi all, I have many files that have 1 or more occurrences of the information I want. There are two distinct sets of information. I want get this info and place each occurrence in its own file. The 3 lines before one set are this grid 00 01 02 16 17 18 **40 lines of code I want to... (5 Replies)
Discussion started by: gobi
5 Replies

2. Shell Programming and Scripting

Print lines with specific character at nth position in a file

I need to print lines with character S at nth position in a file...can someone pl help me with appropriate awk command for this (2 Replies)
Discussion started by: manaswinig
2 Replies

3. Shell Programming and Scripting

Print lines with specific character at nth position in a file

I need to print lines with character S at nth position in a file...can someone pl help me with appropriate awk command for this (1 Reply)
Discussion started by: manaswinig
1 Replies

4. Shell Programming and Scripting

extract DDL - output every match to separate file

Hi, i want to extract the 'CREATE INDEX' or 'CREATE UNIQUE INDEX' statements from a ddl file and output each match to a separate file. i was looking around the net but couldnīt find anything. a possible sed-script could be: sed -n '/CREATE*INDEX*/,/COMMIT/p' filename.ddlbut i couldnīt find out... (11 Replies)
Discussion started by: CactusMoon
11 Replies

5. Shell Programming and Scripting

find string nth occurrence in file and print line number

Hi I have requirement to find nth occurrence in a file and capture data from with in lines (between lines) Data in File. <QUOTE> <SESSION> <ATTRIBUTE NAME='Parameter Filename' VALUE='file1.parm'/> <ATTRIBUTE NAME='Service Name' VALUE='None'/> </SESSION> <SESSION> <ATTRIBUTE... (6 Replies)
Discussion started by: tmalik79
6 Replies

6. Shell Programming and Scripting

Extracting lines after nth LINE from an output

Hi all, Here is my problem for which i am breaking my head for past three days.. I have parted command output as follows.. Model: ATA WDC WD5000AAKS-0 (scsi) Disk /dev/sdb: 500GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type ... (3 Replies)
Discussion started by: selvarajvs
3 Replies

7. Programming

Read text from file and print each character in separate line

performing this code to read from file and print each character in separate line works well with ASCII encoded text void preprocess_file (FILE *fp) { int cc; for (;;) { cc = getc (fp); if (cc == EOF) break; printf ("%c\n", cc); } } int main(int... (1 Reply)
Discussion started by: khaled79
1 Replies

8. Shell Programming and Scripting

Print nth line in a file

Bash/Oracle Linux 6.4 A basic requirement. How can I get nth line of a file printed ? Can I use grep in this case ? Example: In the below file, 12th line is "Kernel parameter check passed for rmem_max" . I just want the 12 line to be printed. # cat sometext.txt Kernel version check... (2 Replies)
Discussion started by: John K
2 Replies

9. UNIX for Beginners Questions & Answers

Output to file print as single line, not separate line

example of problem: when I echo "$e" >> /home/cogiz/file.txt result prints to file as:AA BB CC I need it to save to file as this:AA BB CC I know it's probably something really simple but any help would be greatly appreciated. Thank You. Cogiz (7 Replies)
Discussion started by: cogiz
7 Replies

10. UNIX for Beginners Questions & Answers

Awk: output lines with common field to separate files

Hi, A beginner one. my input.tab (tab-separated): h1 h2 h3 h4 h5 item1 grpA 2 3 customer1 item2 grpB 4 6 customer1 item3 grpA 5 9 customer1 item4 grpA 0 0 customer2 item5 grpA 9 1 customer2 objective: output a file for each customer ($5) with the item number ($1) only if $2 matches... (2 Replies)
Discussion started by: beca123456
2 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 07:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy