As I said, awk does NOT use shell variables like that, nor the $((...+1)) shell construct. As you are using bash, the process substitution might work. If
produces
, sourcing the process substitution
will assign all those variables:
But - be careful with that sourcing, as every malicious result will be executed as well!
Hi,
I need help with Sed or AWk command.i want to remove all the numerals from the file name.These files are stored within a text file and after the numerals are removed,i need to redirect its output to another new .txt file.
Input:
aa_1002985_952.xml
aa_bb_032207.txt... (5 Replies)
Hi what would be the sed equivalent of this awk command:
awk '/$getsn/{getline;next}{print}' file
It deletes the variable found and the next line after it in a file.
Thanks (3 Replies)
Sorry for the duplicate thread this one is similar to the one in
https://www.unix.com/shell-programming-scripting/88132-awk-sed-script-read-values-parameter-files.html#post302255121
Since there were no responses on the parent thread since it got resolved partially i thought to open the new... (4 Replies)
Could you interpret the following sed and awk command for me?
command:
cat tempfile2 |sed "s/\(BUILD-3-.*-\.-\)\(.*\..*\..*\)/\2/" | awk '{printf "%-8.8s %-23.23s %-30.30s %-50.50s\n", $1,$2,$3,substr($0,index($0,$4))}' > outfile2 2>/dev/null
input:data in tempfile2... (5 Replies)
Hi All,
I have a file which has following lines :
- Deploy XXX application <server-address>
- info <server-address>
- Deploy XXX application <server-address>
- info <server-address>
- Deploy XXX application <server-address>
- info <server-address>
I want output like this way in... (8 Replies)
My input file gfile values is CTRY=GM&PROJTYPE=SP&PROJECTTYPE=Small+Project
If i am giving PROJECTTYPE then it must give Small Project
awk -F"&" '{for (i=1; i<=NF; i++) if ($i ~ "^"PAT) {sub ("^"PAT"=", "", $i); sed 's/'+'/""/' $i ; print $i }}' PAT=$1 ... (6 Replies)
Hi,
I am running a script sample.sh in bash environment .In the script i am using sed and awk commands which when executed individually from terminal they are getting executed normally but when i give these sed and awk commands in the script it is giving the below errors :-
./sample.sh: line... (12 Replies)
Dear ALL,
I am still struggling with some basic sed operations.
I want to change path in a file as shown below:
case_OM = PV4Reader( FileName='/home/linuxUser/demoCases/s1/case/case.OM' )
to
case_OM = PV4Reader( FileName='/home/linuxUser/demoCases/s2/case/case.OM' )
In this file there... (5 Replies)
Hi All,
This is my first thread. Hopefully you guys can help me out. I have a csv file, that provides access to managers to a tool. The file is loaded onto our server containing all the assc id's with a trailing comma.
For ex: 182950,
123456,
However, we receive a file that... (8 Replies)
Discussion started by: Prateek Dubey
8 Replies
LEARN ABOUT V7
pstat
PSTAT(1M)PSTAT(1M)NAME
pstat - print system facts
SYNOPSIS
pstat [ -aixptuf ] [ suboptions ] [ file ]
DESCRIPTION
Pstat interprets the contents of certain system tables. If file is given, the tables are sought there, otherwise in /dev/mem. The
required namelist is taken from /unix. Options are
-a Under -p, describe all process slots rather than just active ones.
-i Print the inode table with the these headings:
LOC The core location of this table entry.
FLAGS Miscellaneous state variables encoded thus:
L locked
U update time filsys(5)) must be corrected
A access time must be corrected
M file system is mounted here
W wanted by another process (L flag is on)
T contains a text file
C changed time must be corrected
CNT Number of open file table entries for this inode.
DEV Major and minor device number of file system in which this inode resides.
INO I-number within the device.
MODE Mode bits, see chmod(2).
NLK Number of links to this inode.
UID User ID of owner.
SIZ/DEV
Number of bytes in an ordinary file, or major and minor device of special file.
-x Print the text table with these headings:
LOC The core location of this table entry.
FLAGS Miscellaneous state variables encoded thus:
T ptrace(2) in effect
W text not yet written on swap device
L loading in progress
K locked
w wanted (L flag is on)
DADDR Disk address in swap, measured in multiples of 512 bytes.
CADDR Core address, measured in multiples of 64 bytes.
SIZE Size of text segment, measured in multiples of 64 bytes.
IPTR Core location of corresponding inode.
CNT Number of processes using this text segment.
CCNT Number of processes in core using this text segment.
-p Print process table for active processes with these headings:
LOC The core location of this table entry.
S Run state encoded thus:
0 no process
1 waiting for some event
3 runnable
4 being created
5 being terminated
6 stopped under trace
F Miscellaneous state variables, or-ed together:
01 loaded
02 the scheduler process
04 locked
010 swapped out
020 traced
040 used in tracing
0100 locked in by lock(2).
PRI Scheduling priority, see nice(2).
SIGNAL
Signals received (signals 1-16 coded in bits 0-15),
UID Real user ID.
TIM Time resident in seconds; times over 127 coded as 127.
CPU Weighted integral of CPU time, for scheduler.
NI Nice level, see nice(2).
PGRP Process number of root of process group (the opener of the controlling terminal).
PID The process ID number.
PPID The process ID of parent process.
ADDR If in core, the physical address of the `u-area' of the process measured in multiples of 64 bytes. If swapped out, the position in
the swap area measured in multiples of 512 bytes.
SIZE Size of process image in multiples of 64 bytes.
WCHAN Wait channel number of a waiting process.
LINK Link pointer in list of runnable processes.
TEXTP If text is pure, pointer to location of text table entry.
CLKT Countdown for alarm(2) measured in seconds.
-t Print table for terminals (only DH11 and DL11 handled) with these headings:
RAW Number of characters in raw input queue.
CAN Number of characters in canonicalized input queue.
OUT Number of characters in putput queue.
MODE See tty(4).
ADDR Physical device address.
DEL Number of delimiters (newlines) in canonicalized input queue.
COL Calculated column position of terminal.
STATE Miscellaneous state variables encoded thus:
W waiting for open to complete
O open
S has special (output) start routine
C carrier is on
B busy doing output
A process is awaiting output
X open for exclusive use
H hangup on close
PGRP Process group for which this is controlling terminal.
-u print information about a user process; the next argument is its address as given by ps(1). The process must be in main memory, or
the file used can be a core image and the address 0.
-f Print the open file table with these headings:
LOC The core location of this table entry.
FLG Miscellaneous state variables encoded thus:
R open for reading
W open for writing
P pipe
CNT Number of processes that know this open file.
INO The location of the inode table entry for this file.
OFFS The file offset, see lseek(2).
FILES
/unix namelist
/dev/mem default source of tables
SEE ALSO ps(1), stat(2), filsys(5)
K. Thompson, UNIX Implementation
PSTAT(1M)