04-13-2011
awk delimiter
I have several hundred files that look like this:
ABB110405110000.rawfma8
AAB110405110001.rawhr32
If I use the statement ls | awk '{x=$0;gsub("[^0-9]","",x)
I see that all characters other than 0-9 are eliminated but how do I eliminate all characters including numbers after the "."
In my mind I think (just learning) you create a delimiter for "."dot and set x=$1 but what would this look like.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello All, This work could be very easy for you guys. I would really appreciate help.
input file:
output file: (Desired)
What I am capable of doing:
Command: cat inputfile | awk -F\| '{print "num="$1" value="$2" digits="$3" name1="$4" file="$5" code="$6}' > outputfile
Result what I am... (5 Replies)
Discussion started by: onlyroshni
5 Replies
2. Shell Programming and Scripting
RECORD=NEW|~|VENDORN=LUCENT|~|VENDORM=CBX500_REAR|~|NETWORK=ATM|~|SUBNETWORK=N/A|~|SITE=CIL|~|REGION=KN|~|COUNTRY=PS|~|SWITCH=SWITCH1|~|E
THERNET=N/A|~|LOOPBACK=N/A|~|SHELF=N/A|~|SLOT=14|~|SUBSLOT=N/A|~|STSCHAN=N/A|~|PORT=S14|~|DS1SLOT=N/A|~|LINE=N/A|~|LPORTID=N/A|~|CARDDESC=N/A|~|CARDTYPE=BAC2RT0... (7 Replies)
Discussion started by: knijjar
7 Replies
3. Shell Programming and Scripting
Hello,
an awk style question (or a stupid question... it depends on your point of view :) )
How can I write in one awk command these two ones ?
$USER - `grep $USER /etc/passwd | awk -F: '{ print $5 }' | awk -F, '{ print $1 }'`
Thanks
gb (4 Replies)
Discussion started by: gogol_bordello
4 Replies
4. Shell Programming and Scripting
Hi all,
I'm trying to split fields separated by multiple characters :
Here's the string :
"toto"||"ta|ta"||"titi"
Here's what I want :
"toto"||"ta|ta"
I tried several ways, but it seems that my delimiter || is not working :
echo "\"toto\"||\"ta|ta\"||\"titi\"" | awk 'BEGIN... (4 Replies)
Discussion started by: popawu
4 Replies
5. Shell Programming and Scripting
# echo "size(JFJF" | awk -F"size(" '{print $1}'
awk: fatal: Unmatched ( or \(: /size(/
the delimiter is "size(" but i'm not sure if awk is the best tool to use to specify it.
i have tried:
# echo "size(JFJF" | awk -F"size\(" '{print $1}'
awk: warning: escape sequence `\(' treated as... (1 Reply)
Discussion started by: SkySmart
1 Replies
6. UNIX for Dummies Questions & Answers
Hi
I am trying to parse the following lines and has to use * (asterisk) as the delimiter.
These lines are in a file, for example tmp.txt and I am using a while loop
tmp.txt:
14-OCT-2012 06:38:59 *... (1 Reply)
Discussion started by: newbie_01
1 Replies
7. Shell Programming and Scripting
Hi,Below is the output for p3fi_dev services
1/app/oracle> . ./oraprofile_p3fi_dev
p3fi_dev_01 (P):/devoragridcn_01/app/oracle> srvctl config service -d p3fi_dev
p3fi_p3fi_dev.world PREF: p3fi_dev_01 AVAIL: p3fi_dev_02
pplnet_p3fidev PREF: p3fi_dev_01 AVAIL: p3fi_dev_02
nexus_p3fidev PREF:... (3 Replies)
Discussion started by: Vishal_dba
3 Replies
8. Shell Programming and Scripting
Hi ,
Please suggest me how do I use : (colon and one space) as a delimiter in awk
Best regards,
Vishal (2 Replies)
Discussion started by: Vishal_dba
2 Replies
9. Shell Programming and Scripting
datafile:
blah,blah,blah,blah,blah,blah,blah,blah,blah=0_nblah=0-- ,blah,blah,blah
im using the following command to turn the "_n" and "-- " to just a space " " only in the $9th field. meaning, it has to make the changes only in the 9th column/field of the datafile.
awk -F, '{... (1 Reply)
Discussion started by: SkySmart
1 Replies
10. UNIX for Beginners Questions & Answers
I have file 2.txt and I want to change the delimiter form , to :
Not sure what is the problem with below command
cat 2.txt
1,a
2,b
3,d
awk 'BEGIN {FS=",";OFS=":";} {print $0}' 2.txt
Please use CODE tags as required by forum rules! (11 Replies)
Discussion started by: vamsi.valiveti
11 Replies
LEARN ABOUT OSF1
networks
networks(4) Kernel Interfaces Manual networks(4)
NAME
networks - Contains network name information
SYNOPSIS
/etc/networks
DESCRIPTION
The networks file contains information about the known networks that comprise the DARPA (Defense Advanced Research Projects Agency) Inter-
net. Each network is represented by a single line in the networks file. The format for the entries in the networks file is as follows:
Name Number Aliases
The fields contain the following: The official network name. The network number. The unofficial names used for the network.
Items on a line are separated by one or more spaces or tab characters. Comments begin with a # (number sign). Routines that search the
networks file do not interpret characters from the beginning of a comment to the end of that line. Network numbers are specified in dot-
ted-decimal notation. A network name can contain any printable character except a field delimiter, newline character, or comment character
(#).
The networks file is normally created from the official network database maintained at the Network Information Center (NIC). The file may
need to be modified locally to include unofficial aliases or unknown networks.
RELATED INFORMATION
Commands: route(8)
Functions: getnetbyaddr(3), getnetbyname(3), getnetent(3) delim off
networks(4)