If you think that this section is taking too long to get an answer, you may want to consider posting in another section:
Quote:
Emergency UNIX and Linux Support !! Help Me!!
Post your urgent questions here for highest visibility. Posting a new thread to this forum requires Bits. We monitor this forum to help people with emergencies, but we do not guarantee response time or answers.
Here is a script that should get you started:
Code:
#!/usr/bin/env bash
# @(#) s1 Demonstrate extraction and formatting data into table.
# Display local environment.
pe() { for _i;do printf "%s" "$_i";done; printf "\n"; }
pl() { pe;pe "-----" ;pe "$*"; }
db() { ( printf " db, ";for _i;do printf "%s" "$_i";done;printf "\n" ) >&2 ; }
db() { : ; }
pe
C=$HOME/bin/context && [ -f $C ] && $C awk tbl nroff
NAME=${1-root}
# Copy head tbl boilerplate.
cat <<EOF > f1
.TS
box;
|l|l|r|r|r|
-----
|l|l|r|r|r|.
USER PROCESS PROC ID % CPU % MEM
EOF
# Extract data from csv to tsv.
awk -F, -v user="$NAME" '
BEGIN { OFS = "\t" }
$2 ~ user { print $2,$3,$1,$5,$6 }
' data0 >> f1
# Copy tail boilerplate
echo ".TE" >> f1
# Format, replace nroff as necessary.
pe
tbl f1 |
nroff
exit 0
producing:
Code:
$ ./s1
Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution : Debian GNU/Linux 5.0.8 (lenny)
bash GNU bash 3.2.39
awk GNU Awk 3.1.5
tbl GNU tbl (groff) version 1.18.1
nroff GNU nroff (groff) version 1.18.1
+-----+-------------+---------+-------+-------+
|USER | PROCESS | PROC ID | % CPU | % MEM |
+-----+-------------+---------+-------+-------+
|root | init | 1 | 0.0 | 0.1 |
|root | migration/0 | 1008 | 2.0 | 1.8 |
|root | watchdog/0 | 5 | 0.0 | 0.0 |
+-----+-------------+---------+-------+-------+
( ... )
and for:
Code:
$ ./s1 boot
( ... )
+-----+---------+---------+-------+-------+
|USER | PROCESS | PROC ID | % CPU | % MEM |
+-----+---------+---------+-------+-------+
|boot | read0 | 9 | 4.4 | 5.5 |
+-----+---------+---------+-------+-------+
( ... )
Dear Ones,
kindly help me to create a data file from the report file as shown here under( i am new one to unix KNOW BASIC COMMANDS)
file:rama.prt
(ist record)(3 to 4 lines of text with different filed names)
Name :M.LALITHA DOB:12/11/45 DESG :JA(P)
STANO:300175 ... (3 Replies)
Dear Unix champs,
I have a input file as attached, i would like to create an report from the file as below
FileType | EQUENS0001 | EQUENS0002 | EQUENS1100 | EQUENS0003
--------+--------------------------------------------------------
Msg No |... (3 Replies)
Hi
I need to create multiple text files from onc text file on AIX. The data of text files is as below:
**********************************************
**********************************************
DBVERIFY: Release 10.2.0.4.0 - Production on Tue Nov 10 13:45:42 2009
Copyright (c) 1982,... (11 Replies)
OK I will do my best to explain what I need help with.
I am trying to format an ldif file so I can import it into Oracle oid.
I need the file to look like this example. Keep in mind there are 3000 of these in the file.
changetype: modify
replace: userpassword
dn:... (0 Replies)
Hi,
I have two text files. Need to create a third text file extracting specific data from first two existing files..
Text File 1: Format contains:
SQL*Loader: Release 10.2.0.1.0 - Production on Wed Aug 4 21:06:34 2010
some text ............so on...and somwhere text like:
Record 1:... (1 Reply)
Hello everyone,
I work under Ubuntu 11.10 (c-shell)
I need a script to create a new text file whose content is the text of another text files that are in the directory $DIRMAIL at this moment.
I will show you an example:
- On the one hand, there is a directory $DIRMAIL where there are... (1 Reply)
Hi folks,
I have the following data.Any help is greatly appreciated.
order File_name
7222245 7222245.pdf
7222245 7222245a.pdf
7222245 7222245b.pdf
7222245 7222245c.pdf
7222245 7222245d.pdf
7222250 ... (1 Reply)
Hi Guys,
I have file A.txt
File A Data
AK1521
AK2536
AK3164
I want create text file of all data above and write some data on each file.
want Output on below folder
/home/kka/out
AK1521.txt
Hi
Welocme (3 Replies)