Sponsored Content
Full Discussion: Grep from files
Top Forums UNIX for Dummies Questions & Answers Grep from files Post 302812603 by agama on Sunday 26th of May 2013 11:59:06 AM
Old 05-26-2013
Assuming your data is in a file named t.data this is one way:

Code:
awk '
    />/ { split( $1, a, ">" ); sect=a[1]; next; }

    /Start/ {
        s = "";
        printf( "%s ", sect );

        for( i = 2; i <= NF; i++ )
        {
            printf( "%c%s", s, $(i) );
            s = ",";
        }
        printf( "\n" );
        next;
    }

    /Finish/ {
        s = "";
        printf( "%s ", sect );
        for( i = 2; i <= NF; i++ )
        {
            if( substr( $(i), 1, 1 ) != "(" )  #if not a disabled/enabled thing
            {
                printf( "%c%s", s, $(i) );
                s = ",";
            }
        }
        printf( "\n" );
    }
' t.data

This User Gave Thanks to agama For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to grep several files

Hi I am totally new to Unix and I am in need of a script that can grep several files at once. the script needed: change directory grep for keywords "error" "fail" "warning" in different files with different names, same extention but specific file names. if any of the keywords is found to show... (4 Replies)
Discussion started by: sqloyd
4 Replies

2. Shell Programming and Scripting

grep from .z files

There are archived files with .Z in the server. I want to grep a code within those files. How can I do this? Please help. Koho (4 Replies)
Discussion started by: koho
4 Replies

3. Shell Programming and Scripting

how to grep word from .gz files & .z files

Hi I have find some account numbers from .gz files. There thousands of .gz files, also i am unable to grep .gz / .z files. I want to find file names & and those lines from list. Could you pls tell me / give me any syntax for finding word from ,gz files using grep? Thanks in advance (8 Replies)
Discussion started by: udaya_subbu
8 Replies

4. Shell Programming and Scripting

Grep Different Files Using a Loop?

I have a script to GREP for a text expression within certain files, the files being named file.11012008 thru file.11302008. 30 files in all, one for each day of the month. Instead of entering the following 3 lines of code 30 different times, I'm trying to find a way to loop the process: ... (6 Replies)
Discussion started by: foleyml
6 Replies

5. Shell Programming and Scripting

Need to grep for .log files

Hi, Have two files. 1. robin.log 2. robin_log When is grep i shuld get only robin.log file. Please help. I Tried ls | grep ".log" But its not working Thanks Robin (6 Replies)
Discussion started by: robinbannis
6 Replies

6. Shell Programming and Scripting

grep for certain files using a file as input to grep and then move

Hi All, I need to grep few files which has words like the below in the file name , which i want to put it in a file and and grep for the files which contain these names and move it to a new directory , full file name -C20091210.1000-20091210.1100_SMGBSC3:1000... (2 Replies)
Discussion started by: anita07
2 Replies

7. Shell Programming and Scripting

grep all files in a directory

I am not sure if i am doing this correctly since it returns quickly. i need to grep for a keyword in all files in a directory grep keyword /mydirectory is that correct? I just want to know which files have a keyword in it. i am using korn shell in solaris 5.1. There does not appear to... (12 Replies)
Discussion started by: guessingo
12 Replies

8. Shell Programming and Scripting

grep 1000s of files with 1000s of grep values

Hi, I have around 200,000 files in a given directory. I need to cat each of these files and grep them for thousands of identifier values (or strings) in a given text file. The text file looks something like this: 1234 1243545 1234353 121324 etc with thousands of entries. Can... (3 Replies)
Discussion started by: mantis
3 Replies

9. Shell Programming and Scripting

Python - glob () - How to grep same files with different extension files

Hi I Have a directory and i have some files below abc.txt abc.gif gtee.txt ghod.pid umni.log unmi.tar How can use glob function to grep abc files , i have created a variable "text" and i assigned value as "abc", please suggest me how can we use glob.glob( ) to get the output as below... (2 Replies)
Discussion started by: kumar85shiv
2 Replies

10. Shell Programming and Scripting

awk and grep using two files

I have two file one will have WWN and port details and another file will have allies name. I need to check what allies name was given to each wwn and create a consolidate report which will both port details, allies name. file one switchshow 133 1 21 188500 id N4 ... (4 Replies)
Discussion started by: ranjancom2000
4 Replies
MKNTFS(8)						      System Manager's Manual							 MKNTFS(8)

NAME
mkntfs - create an NTFS file system SYNOPSIS
mkntfs [options] device [number-of-sectors] mkntfs [ -C ] [ -c cluster-size ] [ -F ] [ -f ] [ -H heads ] [ -h ] [ -I ] [ -L volume-label ] [ -l ] [ -n ] [ -p part-start-sect ] [ -Q ] [ -q ] [ -S sectors-per-track ] [ -s sector-size ] [ -T ] [ -U ] [ -V ] [ -v ] [ -z mft-zone-multiplier ] [ --debug ] device [ num- ber-of-sectors ] DESCRIPTION
mkntfs is used to create an NTFS file system on a device (usually a disk partition) or file. device is the special file corresponding to the device (e.g /dev/hdXX). number-of-sectors is the number of blocks on the device. If omitted, mkntfs automagically figures the file system size. OPTIONS
Below is a summary of all the options that mkntfs accepts. Nearly all options have two equivalent names. The short name is preceded by - and the long name is preceded by --. Any single letter options, that don't take an argument, can be combined into a single command, e.g. -fv is equivalent to -f -v. Long named options can be abbreviated to any unique prefix of their name. Basic options -f, --fast, -Q, --quick Perform quick (fast) format. This will skip both zeroing of the volume and bad sector checking. -L, --label STRING Set the volume label for the filesystem. -C, --enable-compression Enable compression on the volume. -n, --no-action Causes mkntfs to not actually create a filesystem, but display what it would do if it were to create a filesystem. All steps of the format are carried out except the actual writing to the device. Advanced options -c, --cluster-size BYTES Specify the size of clusters in bytes. Valid cluster size values are powers of two, with at least 256, and at most 65536 bytes per cluster. If omitted, mkntfs uses 4096 bytes as the default cluster size. Note that the default cluster size is set to be at least equal to the sector size as a cluster cannot be smaller than a sector. Also, note that values greater than 4096 have the side effect that compression is disabled on the volume (due to limitations in the NTFS compression algorithm currently in use by Windows). -s, --sector-size BYTES Specify the size of sectors in bytes. Valid sector size values are 256, 512, 1024, 2048 and 4096 bytes per sector. If omitted, mkntfs attempts to determine the sector-size automatically and if that fails a default of 512 bytes per sector is used. -p, --partition-start SECTOR Specify the partition start sector. The maximum is 4294967295 (2^32-1). If omitted, mkntfs attempts to determine part-start-sect automatically and if that fails a default of 0 is used. Note that part-start-sect is required for Windows to be able to boot from the created volume. -H, --heads NUM Specify the number of heads. The maximum is 65535 (0xffff). If omitted, mkntfs attempts to determine the number of heads automati- cally and if that fails a default of 0 is used. Note that heads is required for Windows to be able to boot from the created volume. -S, --sectors-per-track NUM Specify the number of sectors per track. The maximum is 65535 (0xffff). If omitted, mkntfs attempts to determine the number of sec- tors-per-track automatically and if that fails a default of 0 is used. Note that sectors-per-track is required for Windows to be able to boot from the created volume. -z, --mft-zone-multiplier NUM Set the MFT zone multiplier, which determines the size of the MFT zone to use on the volume. The MFT zone is the area at the begin- ning of the volume reserved for the master file table (MFT), which stores the on disk inodes (MFT records). It is noteworthy that small files are stored entirely within the inode; thus, if you expect to use the volume for storing large numbers of very small files, it is useful to set the zone multiplier to a higher value. Note, that the MFT zone is resized on the fly as required during operation of the NTFS driver but choosing a good value will reduce fragmentation. Valid values are 1, 2, 3 and 4. The values have the following meaning: +--------------------------------+ |MFT zone MFT zone size | |multiplier (% of volume size) | | 1 12.5% (default) | | 2 25.0% | | 3 37.5% | | 4 50.0% | +--------------------------------+ -T, --zero-time Fake the time to be 00:00:00 UTC, Jan 1, 1970 instead of the current system time. This is only really useful for debugging pur- poses. -U, --with-uuid Generate a random volume UUID. -I, --no-indexing Disable content indexing on the volume. (This is only meaningful on Windows 2000 and later. Windows NT 4.0 and earlier ignore this as they do not implement content indexing at all.) -F, --force Force mkntfs to run, even if the specified device is not a block special device, or appears to be mounted. Output options -q, --quiet Quiet execution; only errors are written to stderr, no output to stdout occurs at all. Useful if mkntfs is run in a script. -v, --verbose Verbose execution. --debug Really verbose execution; includes the verbose output from the -v option as well as additional output useful for debugging mkntfs. Help options -V, --version Print the version number of mkntfs and exit. -l, --license Print the licensing information of mkntfs and exit. -h, --help Show a list of options with a brief description of each one. BUGS
If you find a bug please send an email describing the problem to the development team: ntfs-3g-devel@lists.sf.net AUTHORS
mkntfs was written by Anton Altaparmakov, Richard Russon, Erik Sornes and Szabolcs Szakacsits. It was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre. AVAILABILITY
mkntfs is part of the ntfs-3g package and is available from: http://www.tuxera.com/community/ SEE ALSO
badblocks(8), ntfsprogs(8) ntfs-3g 2011.4.12AR.4 January 2006 MKNTFS(8)
All times are GMT -4. The time now is 04:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy