Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to print the line from the file in the desired format:? Post 302789739 by Anamica on Thursday 4th of April 2013 06:20:26 AM
Old 04-04-2013
Thanks , it worked on the command line , so i am writig script for the same and trying to redirect the output of this command line, file is gettring created but its an empy file :-(
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

capturing the time stamp in desired format

Hello All, I am working on korn shell script.i have 2 questions; 1) I have a file and i am able to capture the arrival time. the arrival time is capturing as 11:30 ls -ltr aaa.bbb.332121312.*.* | awk -F" " '{print $8}' 11:30 my desired output is 113000 can anyone please suggest me... (2 Replies)
Discussion started by: pavan_test
2 Replies

2. UNIX for Advanced & Expert Users

get the timestamp of a file in desired format

Hi, I have a file say abc. I get the timestamp in following way: ls -ltr abc | awk -F" " '{print $6,$7,$8}' Mar 8 10:23 I need to get the timestamp as : 03-08-2007 10:23:00 Thanks Sumeet (1 Reply)
Discussion started by: sumeet
1 Replies

3. HP-UX

Desired Format !

Hi everybody, I just need desired ouput from text file which should have folowing format; "2007-06-25 00:03:32.926+05:30",12354369,"Load","Completed","Rs.-5,556.00",9452217714 "2007-06-25 00:06:57.357+05:30",12354371,"Load","Completed","Rs.-56.00",9415766266 "2007-06-25... (1 Reply)
Discussion started by: prasanth_babu
1 Replies

4. Shell Programming and Scripting

Need your help to get the output of the list in desired format

Hello Guys, I am working on a script and using the below code to fetch the list of all repositories CHDIR='/mnt/scm/subversion/' repolist() { cd ${CHDIR} Repo=`ls|cut -d " " -f1` echo $Repo } Output of the above code is BSB CIB COB DCI DIB DSB ESB-P ESB-TOOLS FareVerify GCACHE GWY... (15 Replies)
Discussion started by: rohit22hamirpur
15 Replies

5. UNIX for Dummies Questions & Answers

Help with saving file in desired format

Hi I have the following file in the unix named emp. ID,NAME,SAL,DEPT 101,aaa,2000,10 102,bbb,3000,20 103,ccc,4000,30 104,ddd,5000,40 105,aaa,2000,50 106,bbb,3000,60 107,ccc,4000,70 108,ddd,5000,10 109,aaa,2000,80 I need to save first 3 columns(ID, NAME, SAL) in another file with... (2 Replies)
Discussion started by: alok3141
2 Replies

6. Shell Programming and Scripting

Desired Date format

I need to get the current year for the files that has been created today. Ex- when i list in unix console it shows ls -l abc.txt -rw-rw-r-- 1 user1 user1 33 May 2 08:58 abc.txt but i need to get as May 2 2013 , i dont need 08:58 is there any command to list it out in that... (7 Replies)
Discussion started by: Prashanth B
7 Replies

7. Shell Programming and Scripting

Print Value between desired html tag

Hi, I have a html line as below :-... (6 Replies)
Discussion started by: satishmallidi
6 Replies

8. UNIX and Linux Applications

Lpr send to print a4 format and print letter format

Hi! How we are? I have an A4 PDF in my server, and i must send it to phisically printer. I use the comand: lpr -P printername -o media=A4 archive.pdf And the printer prints it in letter format, i don't know why. ¿Have ideas or solution? Thanks, my best regards. (6 Replies)
Discussion started by: dcastellini
6 Replies

9. Shell Programming and Scripting

Needed shell script to append desired text to each line in a file

Hi, I had generated a report in my tool as followsoutput.txt 43.35 9 i needed the script to generate a new file like below i want to append the text to each of these lines of my filenewoutputfile.txt should be Total Amount : 43.35 Record Count:9 Regards, Vasa Saikumar. ... (2 Replies)
Discussion started by: hemanthsaikumar
2 Replies

10. Shell Programming and Scripting

Print if found non-desired result

I have a result like this root@server # grep -rl maldet /etc/cron* /etc/cron.d/maldet_daily /etc/cron.d/malcron /etc/cron.d/malcrondaily /etc/cron.d/malcronweekly What I need is, I need an if/else condition such that, if there is any output other than /etc/cron.d/maldet_daily in the... (8 Replies)
Discussion started by: anil510
8 Replies
xjobs(1)							   User Commands							  xjobs(1)

NAME
xjobs - construct command line and execute jobs in parallel SYNOPSIS
xjobs [options] [utility [argument ...]] DESCRIPTION
xjobs reads job descriptions line by line and executes them in parallel. It limits the number of parallel executing jobs and starts new jobs when jobs finish. Therefore, it combines the arguments from every input line with the utility and arguments given on the command line. If no utility is given as an argument to xjobs, then the first argument on every job line will be used as utility. To execute utility xjobs searches the directories given in the PATH environment variable and uses the first file found in these directories. xjobs is most useful on multiprocessor machines when one needs to execute several time consuming commands that could possibly be run in parallel. With xjobs this can be achieved easily, and it is possible to limit the load of the machine to a useful value. It works similar to xargs, but starts several processes simultaneously and gives only one line of arguments to each utility call. By using I/O redirectors the standard input, output, and error stream of executed jobs can be redirected. Use < to redirect standard input, > to redirect standard output, >! to redirect standard output and overwrite an existing file, >> to append standard output to an existing file, >& to redirect both standard output and standard error output to the same file, and >>& to append both standard output and standard error output to the same file. If passed on the command line, these operators specify the default I/O redirection that can be overwritten by specifying another redirector to a specific job on its argument line. After all these operators a filename is expected. See EXAMPLES below for an example. If you need more advanced shell features than the redirection operators supported by xjobs, then use as utility a shell of your preference. Every job line can be preceeded by a "cd directory;" command that tells xjobs in which directory the job shall be executed. For every line this can only be used once. For more complex scripting, please pass the line to execute to a shell of your choice. xjobs constructs the arguments of the jobs to execute from each input line. Each input line will create a seperate job, whereas newline character are handled as regular whitespace by xargs. To be able to include whitespace charakters in arguments, either preceed them with a backslash or quote them with single or doublequote charakters. A backslash charakter preceeding a newline will make xjobs ignore the new- line character, thus giving you the ability to pass arguments for a single job across multiple lines. To include quotation marks in quoted arguments, preceed them with a backslash. Lines passed to xjobs beginning with a # charakter are interpreted as comments. Finally, xjobs also includes a mechanism for serializing the execution. Like this it is possible to parallelize independent jobs and sequence jobs that have a dependency. This can be achieved by inserting a line that only consists of two percentage charakters in sequence (%%). All jobs before this sequence point are executed at the requested number of jobs in parallel. When hitting the sequence point xjobs waits for all processes to finish and then continues starting jobs that follow the sequence point. When passing a named pipe (i.e. a file name created by mkfifo) via option -s as an input, xjobs will close and reopen the fifo when reach- ing end-of-file. Like this it is possible to setup an xjobs server and sending jobs to this server from muliple programs. See section EXAM- PLES below for an example. OPTIONS
-j <jobs> Sets the maximum number of jobs that are started in parallel. The default value is to limit the number executing jobs is equal to the number of online processors in the system. If the number passed as <jobs> is followed by an 'x' charakter (e.g. 2.5x), the value is multiplied with the number of online processors before setting the job limit. I.e. having a machine with 4 online processors and passing 2.5x as an argument to option -j will yield a joblimit of 10 jobs. -s <script> Use file script instead of the standard input to read the job descriptions. -n Redirect standard output and standard error output of executed jobs to /dev/null. -l <num> Combine the arguments of <num> input lines for a single job. -p Start jobs interactively, prompting the user. -q <num> Limits the number of queued jobs to num elements. Normally xjobs reads in jobs from standard input or the give script and queues them if they cannot be started at once. With this option, xjobs will stop reading as soon as num jobs are queued and restart reading when a new job has been started. Like this xjobs allocates less memory. Use this option, if you pass huge number of jobs to xjobs, to limit memory consumption. It can also increase performance of xjobs, but be sure that jobs get fed fast enough to xjobs. -1 Pass one argument per job, which is expected to be terminated by a new-line character. No argument parsing is performed. That way it is more easy to process jobs where arguments may include whitespace character or other tokens that influence argument parsing. -0 Same as -1, but as a job and argument termination character a null-character () is expected instead of a new-line character. That way also arguments with new-line character can be processed without escape sequences. -V Print the version number of xjobs and exit. -v <level> Set verbosity of xjobs to level. Valid leves are: 0=silent, 1=error, 2=warning, 3=info, 4=debug. The default level of verbosity is 3. EXAMPLES
If you have a lot of .zip files that you want to extract, then use xjobs like this: $ ls -1 *.zip | xjobs unzip If you want to do the same without getting the output of each unzip task on your terminal, then try this: $ ls -1 *.zip | xjobs -n unzip To gzip all *.bak files in a given directory hierarchy, use it the following way: $ find . -name '*.bak' | xjobs gzip To generate index files for a set of *.jar files, you can use the redirection feature of xjobs, and do the following: $ ls -1 *.jar | sed 's/(.*)/1 > 1.idx/' | xjobs jar tf If you also want to capture the error output, than use >& instead of >. You can also use it to execute several different commands. Therefore, write a script file that contains every job you want to execute and pass it to xjobs with the option -s: $ cat - > script unzip my.zip tar xf my.tar lame --silent my.wav my.mp3 crypt notsecret < mydata > secretfile ^D $ xjobs -s script To be able to queue up jobs from multiple sources with xjobs, use a named pipe and pass it explicitly as input script. Then write the jobs to the named pipe: $ mkfifo /var/run/my_named_pipe $ xjobs -s /var/run/my_named_pipe & $ echo unzip 1.zip >> /var/run/my_named_pipe $ echo tar cf /backup/myhome.tar /home/me >> /var/run/my_named_pipe ENVIRONMENT VARIABLES
PATH Determines the location of command. AUTHORS
Thomas Maier-Komor <thomas@maier-komor.de> Donations via PayPal are welcome! HOMEPAGE
http://www.maier-komor.de/xjobs.html LICENSE
GNU General Public License Version 2 SEE ALSO
xargs(1) Thomas Maier-Komor 20100915 xjobs(1)
All times are GMT -4. The time now is 04:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy