Sponsored Content
Full Discussion: while - comparision
Top Forums Shell Programming and Scripting while - comparision Post 302143251 by Klashxx on Wednesday 31st of October 2007 09:43:13 AM
Old 10-31-2007
Try this:
Code:
#!/usr/bin/ksh
noofdirs=`ls *.tar | wc -l`
if ( noofdirs <> 0 )
then
   i=1
   while ( i <= noofdirs )
   do
      echo $i
      mkdir $i
      file1=`ls *.tar | head -1`
      mv $file1 $i
      (( i += 1 ))
      echo $i
   done
fi

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

date comparision

Hello, I am trying to compare two dates which are in variables and i am not getting the correct result as expected. $first_date = '07/19/2007' $second_date='07/20/2007' Can you please suggest how to i check whether they are equal or not. if ($first_date -eq $second_date) condition is not... (3 Replies)
Discussion started by: kotasateesh
3 Replies

2. Shell Programming and Scripting

File comparision

HI, I would like to know how to compare two files and replace non-matching lines with "_" . I can get non-mathing lines with grep -v -f file1 file2 i just want to knw how to display 'file2' with non-matching lines from 'file1' replaced by "_" for exmaple file1: a b c d ... (2 Replies)
Discussion started by: maddy81
2 Replies

3. Shell Programming and Scripting

File comparision

Hi All I have to files cat a.txt AAA BBB CCC DDD and cat b.txt AAA CCC EEE i want to compare these two files and o/p should have content of file a.txt which is not in file b.txt c.txt BBB DDD Please help me (1 Reply)
Discussion started by: aaysa123
1 Replies

4. Shell Programming and Scripting

File comparision

Hi All I have to files cat a.txt AAA BBB CCC DDD and cat b.txt AAA CCC EEE i want to compare these two files and o/p should have content of file a.txt which is not in file b.txt c.txt BBB DDD Please help me (3 Replies)
Discussion started by: aaysa123
3 Replies

5. UNIX for Advanced & Expert Users

Comparision of two files.

File Structure file1.txt.arch 029429288,1,,,02087400376,N,02087400376,N,0,02087400376,N,0,0,8010,08000151736,U,N,,08000151736,U,20100726111237,20100726111237,0,20100726111651,00004140,16,16,10,N;... (1 Reply)
Discussion started by: ravigupta2u
1 Replies

6. Shell Programming and Scripting

String comparision

I have a string like ab or abc of whatever length. But i want to know whether another string ( for example, abcfghijkl, OR a<space> bcfghijkl ab<space> cfghijkl OR a<space>bcfghijkl OR ab<space> c<space> fghijkl ) starts with ab or abc... space might existing on the longer string... If so, i... (1 Reply)
Discussion started by: nram_krishna@ya
1 Replies

7. Shell Programming and Scripting

String Comparision

I want to compare two strings using awk dynamically without trimming the spaces and want to find the count of matching string. Input Strings file: File1 content (file1): " a " " a2 " File2 content (file2): " a " " a " " a2 " " b2 " " c2 "... (3 Replies)
Discussion started by: AhmedLakadkutta
3 Replies

8. Shell Programming and Scripting

Need help in comparision of two strings

I have two files. one files contain counts and second contain string. Now i have to compare two string . if two string are same i have to add count. If strings are same more than once i have to display final output. like this >Count.txt 1 3 12 4 5 6 1 >strings.txt AA BB BB... (1 Reply)
Discussion started by: pjlotiya
1 Replies

9. UNIX for Advanced & Expert Users

Permission Comparision

Hi, I need to know how to compare the permissions of files which are in two different directories in Unix.. Experts - can any one help on this..!!! (1 Reply)
Discussion started by: yanis
1 Replies

10. Shell Programming and Scripting

Awk comparision

Hi Everyone I am new to Unix shell scripting Can anyone please explain me in detail how this command works awk -F@ 'NR==FNR{A=$2;next}$3 in A{$3=A}1' file2 file1 The above command I got it from this forum, but unable to implement it as I am not getting how this works:mad: I... (3 Replies)
Discussion started by: Vijay90
3 Replies
virt-tar-out(1) 					      Virtualization Support						   virt-tar-out(1)

NAME
virt-tar-out - Pack a virtual machine disk image directory into a tarball. SYNOPSIS
virt-tar-out -a disk.img /dir files.tar virt-tar-out -d domain /dir files.tar virt-tar-out -d domain /dir - | gzip --best > files.tar.gz DESCRIPTION
"virt-tar-out" packs a virtual machine disk image directory into a tarball. The first parameter is the absolute path of the virtual machine directory. The second parameter is the tar file to write. Use "-" to write to standard output. EXAMPLES
Download the home directories from a guest: virt-tar-out -d MyGuest /home - | gzip --best > homes.tar.gz JUST A SHELL SCRIPT WRAPPER AROUND GUESTFISH
This command is just a simple shell script wrapper around the guestfish(1) "tar-out" command. For anything more complex than a trivial copy, you are probably better off using guestfish directly. OPTIONS
Since the shell script just passes options straight to guestfish, read guestfish(1) to see the full list of options. SEE ALSO
guestfish(1), virt-cat(1), virt-copy-in(1), virt-copy-out(1), virt-edit(1), virt-tar-in(1), <http://libguestfs.org/>. AUTHORS
Richard W.M. Jones ("rjones at redhat dot com") COPYRIGHT
Copyright (C) 2011 Red Hat Inc. <http://libguestfs.org/> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. libguestfs-1.18.1 2013-12-07 virt-tar-out(1)
All times are GMT -4. The time now is 12:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy