Sponsored Content
Top Forums Shell Programming and Scripting Running rename command on large files and make it faster Post 302549418 by yazu on Tuesday 23rd of August 2011 03:47:27 AM
Old 08-23-2011
Look for "rename" command on your system and its man page.
This User Gave Thanks to yazu For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Error when running the make command

Hi, Not really sure whether this question should go to this forum but am giving it a shot. I have compiled a simple C program test.c. #include <stdio.h> #include <stdlib.h> #include <string.h> static int a; int test() { a=a+1; return a; } When I run a make command, I get this: ... (2 Replies)
Discussion started by: nattynatty
2 Replies

2. Shell Programming and Scripting

Can anyone make this script run faster?

One of our servers runs Solaris 8 and does not have "ls -lh" as a valid command. I wrote the following script to make the ls output easier to read and emulate "ls -lh" functionality. The script works, but it is slow when executed on a directory that contains a large number of files. Can anyone make... (10 Replies)
Discussion started by: shew01
10 Replies

3. Red Hat

Re:How to make the linux pc faster

Hi, Can any one help me out in solving the problem i have a linux database server it is tooo slow that i am unable to open even the terminial is there any solution to get rid of this problem.How to make this server faster. Thanks & Regards Venky (0 Replies)
Discussion started by: venky_vemuri
0 Replies

4. Emergency UNIX and Linux Support

Help to make awk script more efficient for large files

Hello, Error awk: Internal software error in the tostring function on TS1101?05044400?.0085498227?0?.0011041461?.0034752266?.00397045?0?0?0?0?0?0?11/02/10?09/23/10???10?no??0??no?sct_det3_10_20110516_143936.txt What it is It is a unix shell script that contains an awk program as well as... (4 Replies)
Discussion started by: script_op2a
4 Replies

5. Shell Programming and Scripting

Make script faster

Hi all, In bash scripting, I use to read files: cat $file | while read line; do ... doneHowever, it's a very slow way to read file line by line. E.g. In a file that has 3 columns, and less than 400 rows, like this: I run next script: cat $line | while read line; do ## Reads each... (10 Replies)
Discussion started by: AlbertGM
10 Replies

6. UNIX for Dummies Questions & Answers

Rename a large number of files in subdirectories

Hi, I have a large number of subdirectories (>200), and in each of these directories there is a file with a name like "opp1234.dat". I'd like to know how I could change the names of these files to say "out.dat" in all these subdirectories in one go. Thanks! (5 Replies)
Discussion started by: lost.identity
5 Replies

7. Shell Programming and Scripting

Faster command to remove headers for files in a directory

Good evening Im new at unix shell scripting and im planning to script a shell that removes headers for about 120 files in a directory and each file contains about 200000 lines in average. i know i will loop files to process each one and ive found in this great forum different solutions... (5 Replies)
Discussion started by: alexcol
5 Replies

8. Shell Programming and Scripting

awk changes to make it faster

I have script like below, who is picking number from one file and and searching in another file, and printing output. Bu is is very slow to be run on huge file.can we modify it with awk #! /bin/ksh while read line1 do echo "$line1" a=`echo $line1` if then echo "$num" cat file1|nawk... (6 Replies)
Discussion started by: mirwasim
6 Replies

9. Shell Programming and Scripting

How to make awk command faster?

I have the below command which is referring a large file and it is taking 3 hours to run. Can something be done to make this command faster. awk -F ',' '{OFS=","}{ if ($13 == "9999") print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12 }' ${NLAP_TEMP}/hist1.out|sort -T ${NLAP_TEMP} |uniq>... (13 Replies)
Discussion started by: Peu Mukherjee
13 Replies

10. Shell Programming and Scripting

How to make awk command faster for large amount of data?

I have nginx web server logs with all requests that were made and I'm filtering them by date and time. Each line has the following structure: 127.0.0.1 - xyz.com GET 123.ts HTTP/1.1 (200) 0.000 s 3182 CoreMedia/1.0.0.15F79 (iPhone; U; CPU OS 11_4 like Mac OS X; pt_br) These text files are... (21 Replies)
Discussion started by: brenoasrm
21 Replies
chroot(8)						      System Manager's Manual							 chroot(8)

NAME
chroot - Changes the root directory of a command SYNOPSIS
/usr/sbin/chroot directory command DESCRIPTION
Only root can use the chroot command. The chroot command changes the root directory from / to the specified directory when the command executes. (The command specified includes both the command name as well as any arguments.) Consequently, the root of any path (as indicated by the first / (slash) in the pathname) changes to directory and is always relative to the current root. Even if the chroot command is in effect, directory is relative to the current root of the running process. Several programs may not operate properly after chroot executes. You must ensure that all vital files are present in the new root file system and the relevant pathnames for the files map correctly in the new root file system. For example, the ls -l command fails to give user and group names if the new root file system does not have a copy of the /etc/passwd and /etc/group files. If the /etc/passwd and /etc/group files in the new root file system represent different user and group names, then the output from the ls -l command will be based on those names, not the ones for the system's own name database. Utilities that depend on description files produced by the ctab command may also fail if the required description files are not present in the new root file system. The chroot program uses the execv() function to invoke the specified command. As a consequence, the command specified must be an exe- cutable binary, not a shell script. Further, if the program requires indirect loading (for example, due to unresolved symbols requiring use of a shared library), then /sbin/loader as well as any files it requires (for example, shared libraries) must be present in the new root file system in the appropriate locations. EXAMPLES
To run a subshell with another file system as the root, enter a command similar to the following. Note in this example, the file system is on the /dev/disk/dsk13a device and is mounted to /mnt/dsk13a: chroot /mnt/dsk13a /sbin/sh The command shown in the previous example spec- ifies a change from the current root file system to the one mounted on /mnt/dsk13a while /sbin/sh (which itself is relative to the new root file system) executes. When /bin/sh executes, the original root file system is inaccessible. The file system mounted on /mnt/dsk13a must contain the standard directories of a root file system. In particular, the shell looks for commands in /sbin, /bin, and /usr/bin (among others) on the new root file system. Running the /sbin/sh command creates a subshell that runs as a separate process from the original shell. Press to exit the subshell and return to the original shell. This restores the environment of the original shell, including the meanings of the current directory (.) and the root directory (/). To run a command in another root file system and save the output on the initial root file system, enter a command similar to the following. Note in this example, the file system is on the /dev/disk/dsk13a device and is mounted to /mnt/dsk13a: chroot /mnt/dsk13a /bin/cc -E /u/bob/prog.c > prep.out The previous command runs the /bin/cc command with /mnt/dsk13a as the specified root file system. It compiles the /mnt/dsk13a/u/bob/prog.c file, reads the #include files from the /mnt/dsk13a/usr/include directory, and puts the compiled text in the prep.out file on the initial root file system. To create a file relative to the original root rather than the new one, use this syntax and enter: chroot directory command > file CAUTIONS
If special files in the new root have different major and minor device numbers than the initial root directory, it is possible to overwrite the file system. FILES
Specifies the command path. RELATED INFORMATION
Commands: cc(1), cpp(1), ls(1), sh(1) Functions: chdir(2), chroot(2) exec(2) delim off chroot(8)
All times are GMT -4. The time now is 09:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy