Sponsored Content
Top Forums Shell Programming and Scripting Extracting non multiple files via script Post 302722699 by emily on Sunday 28th of October 2012 10:43:41 AM
Old 10-28-2012
Quote:
Originally Posted by RudiC
I'm not sure I understand your code snippet.

The following will do the job if run in the target directory; it works on my linux/bash/mawk system:
Code:
ls -l|sort -k8 -k5,5rn|awk '/root/ && !Exist[substr($9,1,7)]++'
-rw-r--r-- 1 emily us_cms 100 Oct 27 10:28 vgtee_1_ujf.root
-rw-r--r-- 1 emily us_cms 12 Oct 27 10:28 vgtee_2_ujf.root
-rw-r--r-- 1 emily us_cms 10 Oct 27 10:28 vgtee_3_ujf.root
-rw-r--r-- 1 emily us_cms  7 Oct 27 10:28 vgtee_4_ujh.root
-rw-r--r-- 1 emily us_cms  9 Oct 27 10:28 vgtee_5_ujh.root

You may want to add the full path to the output as you did in your own example.
Hi,
yes thats wat I want with the full path. But the issue is that $FileName has first row as blank. I do not want that. So is there any way to avoid such blank row in the $FileName.

merci,
thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

bash - batch script for extracting one file from multiple tar files

so i have hundreds of files named history.20071112.tar (history.YYYYMMDD.tar) and im looking to extract one file out of each archive called status_YYYYMMDDHH:MM.lis here is what i have so far: for FILE in `cat dirlist` do tar xvf $FILE ./status_* done dirlist is a text... (4 Replies)
Discussion started by: kuliksco
4 Replies

2. Shell Programming and Scripting

Help in extracting multiple files and taking average at same time

Hi, I have 20 files which have respective 50 lines with different values. I would like to process each line of the 50 lines in these 20 files one at a time and do an average of 3rd field ($3) of these 20 files. This will be output to an output file. Instead of using join to generate whole... (8 Replies)
Discussion started by: ahjiefreak
8 Replies

3. UNIX for Advanced & Expert Users

Extracting files with multiple links-perl

i want to write a perl script that gets/displays all those files having multiple links (in current directory) (4 Replies)
Discussion started by: guptesanket
4 Replies

4. UNIX for Dummies Questions & Answers

Extracting columns from multiple files with awk

hi everyone! I already posted it in scripts, I'm sorry, it's doubled I'd like to extract a single column from 5 different files and put them together in an output file. I saw a similar question for 2 input files, and the line of code workd very well, the code is: awk 'NR==FNR{a=$2; next}... (1 Reply)
Discussion started by: orcaja
1 Replies

5. Shell Programming and Scripting

Extracting columns from multiple files with awk

hi everyone! I'd like to extract a single column from 5 different files and put them together in an output file. I saw a similar question for 2 input files, and the line of code workd very well, the code is: awk 'NR==FNR{a=$2; next} {print a, $2}' file1 file2 I added the file3, file4 and... (10 Replies)
Discussion started by: orcaja
10 Replies

6. UNIX for Dummies Questions & Answers

Finding and Extracting uniq data in multiple files

Hi, I have several files that look like this: File1.txt Data1 Data2 Data20 File2.txt Data1 Data5 Data10 File3.txt Data1 Data2 Data17 File4.txt (6 Replies)
Discussion started by: Fahmida
6 Replies

7. Shell Programming and Scripting

Extracting/condensing text from multiple files to multiples files

Hi Everyone, I'm really new to all this so I'm really hoping someone can help. I have a directory with ~1000 lists from which I want to extract lines from and write to new files. For simplicity lets say they are shopping lists and I want to write out the lines corresponding to apples to a new... (2 Replies)
Discussion started by: born2phase
2 Replies

8. Shell Programming and Scripting

extracting information from multiple files

Hello there, I am trying to extract (string) information ( a list words) from 4 files and then put the results into 1 file. Currently I am doing this using grep -f list.txt file1 . and repeat the process for the other 3 files. The reasons i am doing that (a) I do know how to code (b) each file... (4 Replies)
Discussion started by: houkto
4 Replies

9. Shell Programming and Scripting

Extracting lines based on identifiers into multiple files respectively

consider the following is the contents of the file cat 11.sql drop procedure if exists hoop1 ; Delimiter $$ CREATE PROCEDURE hoop1(id int) BEGIN END $$ Delimiter ; . . . . drop procedure if exists hoop2; Delimiter $$ CREATE PROCEDURE hoop2(id int) BEGIN END $$ (8 Replies)
Discussion started by: vivek d r
8 Replies

10. Shell Programming and Scripting

Extracting specific files from multiple .tgz files

Hey, I have number of .tgz files and want to extract the file with the ending *results.txt from each one. I have tried for file in *.tgz; do tar --wildcards -zxf $file *results.txt; doneas well as list=$(ls *.tgz) for i in $list; do tar --wildcards -zxvf $i *.results.txt; done... (1 Reply)
Discussion started by: jfern
1 Replies
Class::Accessor::Children::Fast(3pm)			User Contributed Perl Documentation		      Class::Accessor::Children::Fast(3pm)

NAME
Class::Accessor::Children::Fast - Faster, child-class/accessor generation SYNOPSIS
BEFORE (WITHOUT THIS) package MyClass::Foo; use base qw( Class:Accessor::Fast ); __PACKAGE__->mk_ro_accessors(qw( jacob michael joshua ethan )); package MyClass::Bar; use base qw( Class:Accessor::Fast ); __PACKAGE__->mk_ro_accessors(qw( emily emma madison isabella )); package MyClass::Baz; use base qw( Class:Accessor::Fast ); __PACKAGE__->mk_ro_accessors(qw( haruka haruto miyu yuto )); AFTER (WITH THIS) package MyClass; use base qw( Class::Accessor::Children::Fast ); __PACKAGE__->mk_child_ro_accessors( Foo => [qw( jacob michael joshua ethan )], Bar => [qw( emily emma madison isabella )], Baz => [qw( haruka haruto miyu yuto )], ); DESCRIPTION
This module automagically generates child classes which have accessor/mutator methods. This module inherits "Class::Accessor::Fast" to make accessors. METHODS
This module provides the following methods in addition to all methods provided by "Class::Accessor::Fast". mk_child_accessors MyClass->mk_child_accessors( Foo => @fields, ... ); This generates a child class named "MyClass::Foo" which have accessor/mutator methods each named in "@fields". mk_child_ro_accessors MyClass->mk_child_ro_accessors( Bar => @fields, ... ); This generates a child class named "MyClass::Bar" which have read-only accessors (ie. true accessors). mk_child_wo_accessors MyClass->mk_child_wo_accessors( Baz => @fields, ... ); This generates a child class named "MyClass::Baz" which have write-only accessor (ie. mutators). SEE ALSO
Class::Accessor::Children Class::Accessor::Fast AUTHOR
Yusuke Kawasaki <http://www.kawa.net/> COPYRIGHT AND LICENSE
Copyright (c) 2007 Yusuke Kawasaki. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.0 2007-08-16 Class::Accessor::Children::Fast(3pm)
All times are GMT -4. The time now is 06:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy