Sponsored Content
Top Forums Shell Programming and Scripting Script to compact information ! Post 302379903 by ahmad.diab on Sunday 13th of December 2009 06:37:21 AM
Old 12-13-2009
use below:-


Code:
gawk -F"," '{ split($3,a,"\/") ; if ( a[2] < 10) {$3=a[3]a[1]"0"a[2]}
else {$3=a[3]a[1]a[2] }}1' OFS="," file.txt

SmilieSmilieSmilieSmilie

Last edited by ahmad.diab; 12-21-2009 at 06:16 AM..
This User Gave Thanks to ahmad.diab For This Post:
 

6 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

formatting a Compact Flash in DOS format

:confused: I tryied to use the mount Command (and the msdos.utils) in Darwin 1.4 (OS X) to format a Compact Flash in DOS Format (I had already this native format but I changed it with Disk Utility in MacOS standard and the PC Card slot of a Windows 98-Laptop can't nore read the card) I want to... (1 Reply)
Discussion started by: dreamsurfer
1 Replies

2. Linux

How to Burn .gp Oracle 9.2.0.4.0 to Compact Disc Media on Windows Box

Hi All, I Downloaded Oracle 9.2.0.4.0 for Linux AS 4 and the file format is Directions to extract the files 1. Run "gunzip <filename>" on all the files. Eg. ship_9204_linux_disk1.cpio.gz 2. Extract the cpio archives with the command "cpio -idmv < <filename>" Eg. cpio -idmv... (0 Replies)
Discussion started by: prakashpichika
0 Replies

3. UNIX for Dummies Questions & Answers

User information script

Hi Guys, I just started learning unix and was wondering if anyone can assist me with my User info script.The script file lets the user input their personal information (Their name, address, phone number etc...). The script will then ask the user to input the info again if the input is incorrect... (2 Replies)
Discussion started by: rc1138
2 Replies

4. Shell Programming and Scripting

Compact 3-D output from a big input like:

Hi Experts!!!! Tried a lot but in vein,no success, please help to achieve this LOGIC behind is first field is reffrance row field, the second field shoud be made titles of coulmn and the the third field is made as matrix value. And if they dont match the matrix value should be 0. (Unix (Shell,... (1 Reply)
Discussion started by: ashis.tewari
1 Replies

5. Ubuntu

Format a compact flash card in Ubuntu

I need some assistance formatting a compact flash card in Ubtunu. I connect up the CF card through a USB reader. Ubuntu recognizes the reader usb device, but does not "mount" the CF card as a device. The CF card was formatted in FAT32 format. Any help would be greatly appreciated.... (3 Replies)
Discussion started by: genesis211
3 Replies

6. Shell Programming and Scripting

Compact script with array - Good idea?

Hi, I have a shell script where a lot of the code is repeated. I wanted to make the code much more compact so I spoke to a guy and he suggested using arrays, like follows: #!/bin/bash readonly -a nginx=('nginx' '--prefix=/opt' '-j 4' 'http://nginx.org/download/nginx-1.2.2.tar.gz' )... (2 Replies)
Discussion started by: Spadez
2 Replies
SCRIPT(1)							   User Commands							 SCRIPT(1)

NAME
script -- make typescript of terminal session SYNOPSIS
script [-a] [-c command] [-e] [-f] [-q] [-t[=file]] [-V] [-h] [file] DESCRIPTION
script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1). If the argument file is given, script saves all dialogue in file. If no file name is given, the typescript is saved in the file typescript. Options: -a, --append Append the output to file or typescript, retaining the prior contents. -c, --command command Run the command rather than an interactive shell. This makes it easy for a script to capture the output of a program that behaves differently when its stdout is not a tty. -e, --return Return the exit code of the child process. Uses the same format as bash termination on signal termination exit code is 128+n. -f, --flush Flush output after each write. This is nice for telecooperation: one person does `mkfifo foo; script -f foo', and another can super- vise real-time what is being done using `cat foo'. --force Allow the default output destination, i.e. the typescript file, to be a hard or symbolic link. The command will follow a symbolic link. -q, --quiet Be quiet. -t, --timing[=file] Output timing data to standard error, or to file when given. This data contains two fields, separated by a space. The first field indicates how much time elapsed since the previous output. The second field indicates how many characters were output this time. This information can be used to replay typescripts with realistic typing and output delays. -V, --version Output version information and exit. -h, --help Output help and exit. The script ends when the forked shell exits (a control-D to exit the Bourne shell (sh(1)), and exit, logout or control-d (if ignoreeof is not set) for the C-shell, csh(1)). Certain interactive commands, such as vi(1), create garbage in the typescript file. Script works best with commands that do not manipulate the screen, the results are meant to emulate a hardcopy terminal. ENVIRONMENT
The following environment variable is utilized by script: SHELL If the variable SHELL exists, the shell forked by script will be that shell. If SHELL is not set, the Bourne shell is assumed. (Most shells set this variable automatically). SEE ALSO
csh(1) (for the history mechanism), scriptreplay(1). HISTORY
The script command appeared in 3.0BSD. BUGS
Script places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects. AVAILABILITY
The script command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/. util-linux February 2011 util-linux
All times are GMT -4. The time now is 12:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy