Sponsored Content
Top Forums Shell Programming and Scripting Extract variables from filenames and output to file Post 302513463 by malandisa on Wednesday 13th of April 2011 09:58:33 AM
Old 04-13-2011
Hi kevintse,

Thank you! That indeed does what I need. I don't fully understand what the fine detail of how this line does the job.

I have one extra question, what if I want to add another column to the output which is some value extracted from inside the file, would this be done within a command like this??

Thank you
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing filenames/variables into a script

Hi! I'm somewhat new to Unix (I use it to fiddle, but not seriously), and at my work I have come to use it quite a bit. My question is this: I want to create a script to take the tedium out of repetitious tasks. However, I need to pass a file name into the script in order for it to work. ... (5 Replies)
Discussion started by: MrToast
5 Replies

2. Shell Programming and Scripting

How to extract date out of this filenames

I have filenames filenameA_fg_MMDDYY.tar.gz filenameASPQ_fg_MMDDYY.tar.gz filenameAFTOPHYYINGH_fg_MMDDYY.tar.gz filenameAGHYSW_fg_MMDDYY.tar.gz Is there a way I can extract the date out of these filenames? Thanks in advance (2 Replies)
Discussion started by: RubinPat
2 Replies

3. Shell Programming and Scripting

awk splits file in to multiple - how to get filenames in variables withing ksh?

Hi all, I'm using awk in a .ksh script to split one file by line prefix into different files (up to 4). The files are named after the prefix in the line, and a sequence no. Is there any way to get the filenames in to variables too? I need _ftpfile1, _ftpfile2, _ftpfile3 and _ftpfile4 which are... (2 Replies)
Discussion started by: spidermike
2 Replies

4. Shell Programming and Scripting

Using AWK BEGIN to extract file header info into variables

Hi Folks, I've searched for this for quite a while, but can't find any solution - hope someone can help. I have various files with standard headers. eg. <HEADER> IP: 1.2.3.4 Username: Joe Time: 12:00:00 Date: 23/05/2010 </HEADER> This is a test and this part can be any size... (6 Replies)
Discussion started by: damoske
6 Replies

5. Shell Programming and Scripting

Spaces in filenames located in variables in shell.

Greetings. I am trying to do a script that will do some file copying for me. Unfortunately I have spaces in the directory names (which I cannot change) and the result is someone hard to achieve in shell scripts. I have searched everywhere on the web but does not manage to find the answer to... (3 Replies)
Discussion started by: Mr.Glaurung
3 Replies

6. Shell Programming and Scripting

Read file and for each line replace two variables, add strings and save output in another file

Hi All, I have a file, let's call it "info.tmp" that contains data like this .. ABC123456 PCX333445 BCD789833 I need to read "info.tmp" and for each line add strings in a way that the final output is put /logs/ua/dummy.trigger 'AAA00001.FTP.XXX.BLA03A01.xxxxxx(+1)' where XXX... (5 Replies)
Discussion started by: Andy_ARG
5 Replies

7. Shell Programming and Scripting

Extract unique filenames

Hi Unix Gurus, In a script, I am trying to extract unique text from a set of filenames. I have certain files like below in a directory: OPEN_INV_01012011.xls OPEN_INV_01022011.xls OPEN_INV_01032011.xls CLOSE_INV_01012011.xls CLOSE_INV_01022011.xls I need to extract just "OPEN_INV_" ... (4 Replies)
Discussion started by: shankar1dada
4 Replies

8. UNIX for Dummies Questions & Answers

Create csv with output filenames and file size

Hello All, Here is seeking a bit of help in trying to solve a problem. I am required to create a csv file as shown below: output.csv -> output_1,output_2,output_3,...,output_<N> filename1:20,filename2:30,filename3:30,...,filename<N>:30 by listing output_1, output_2,... , output<N> as... (3 Replies)
Discussion started by: vkumbhakarna
3 Replies

9. Shell Programming and Scripting

How to read each line from input file, assign variables, and echo to output file?

I've got a file that looks like this (spaces before first entries intentional): 12345650-000005000GL140227 ANNUAL HELC FEE EN 22345650-000005000GL140227 ANNUAL HELC FEE EN 32345650-000005000GL140227 ANNUAL HELC FEE EN I want to read through the file line by line,... (6 Replies)
Discussion started by: Scottie1954
6 Replies

10. UNIX for Beginners Questions & Answers

Match file and extract the output

Hi All I have 2 file . I need match the files based on key and then form a third file which have the matching values FILE1: 10264;K*AD 10265;K*AIR 10266;K*AUTO 10267;K*BABY 10268;K* FOOD FILE2: 10264;1055.83 10265;716.94 10267;331.80 10268;23283.33 OUTPUT (Needed)... (2 Replies)
Discussion started by: arunkumar_mca
2 Replies
XpCancelJob(3Xp)						 XPRINT FUNCTIONS						  XpCancelJob(3Xp)

NAME
XpCancelJob - Cancels a single print job. SYNOPSIS
cc [ flag... ] file... -lXp [ library... ] #include <X11/extensions/Print.h> void XpCancelJob ( display, discard ) Display *display; Bool discard; ARGUMENTS
display Specifies a pointer to the Display structure; returned from XOpenDisplay. discard When TRUE, specifies that all XPPrintNotify events should be discarded. DESCRIPTION
XpCancelJob cancels an in-progress job. If the job was started with output_mode XPGetData then the data stream to XpGetDocumentData is ter- minated. For many page description languages such arbitrary termination may invalidate the output. If the job was started with output_mode XPSpool then depending on the driver and spooler configuration the entire job may be canceled or a partial job may be generated. If discard is TRUE, all XPPrintNotify events with a detail field of XPEndPageNotify, XPEndDocNotify, or XPEndJobNotify are discarded before XpCancelJob returns. For clients selecting XPPrintMask (see XpSelectInput), the event XPPrintNotify will be generated with its detail field set to XPEndJobNo- tify. DIAGNOSTICS
XPBadContext A valid print context-id has not been set prior to making this call. XPBadSequence The function was not called in the proper order with respect to the other X Print Service Extension calls (for example, XpEndJob prior to XpStartJob). SEE ALSO
XpEndJob(3Xp), XpGetDocumentData(3Xp), XpSelectInput(3Xp), XpStartJob(3Xp) X Version 11 libXp 1.0.0 XpCancelJob(3Xp)
All times are GMT -4. The time now is 07:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy