10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
The four lines in the tab-delimeted input are a sample format from my actual data. The awk is meant to go line by line and check if a pattern is satisfied and if it is follow a particular format (there are 3). All the lines in the file should follow one of the three formats below. I added comments... (4 Replies)
Discussion started by: cmccabe
4 Replies
2. Shell Programming and Scripting
How to find total number of special character in a column?
I am using awk -f "," '$col_number "*$" {print $col_number}' file.csv|wc -l but its not giving correct output. It's giving output as 1 even though i give no special character?
Please use code tags next time for your code and... (4 Replies)
Discussion started by: AjitKumar
4 Replies
3. Shell Programming and Scripting
i am trying to cut the 4th field from the file.
sample file
a1,a2,"a,3",a4,a5,a6
b1,"b,2",b3,b4,b5,b6
c1,"c,2","c,3",c4,c5,c6
i need the output in the format of
a1,a2,"a,3",a5,a6
b1,"b,2",b3,b5,b6
c1,"c,2","c,3",c5,c6
i tried using cut -d, -f1-4,6-
but i am getting the output as ... (10 Replies)
Discussion started by: ATWC
10 Replies
4. Shell Programming and Scripting
Hi,
I have to display the value 16 present in "lcpu=16" which is the output of a command
# vmstat
System configuration: lcpu=16 mem=4096MB
I used as
# hdtype=`vmstat | grep "lcpu" | awk -F "=" '{print $2}'`
# echo $hdtype
16 mem
But I need to display only 16..
Am doing... (3 Replies)
Discussion started by: Priya Amaresh
3 Replies
5. Shell Programming and Scripting
Hi Friends,
I have a file1
i want to retrieve only the fields which have DEP,CITY,TRANS as headers in other file.
Output:
I want to give the input as DEP,CITY,TRANS column names to get the output.
i used cut command .. but if i have 300 fileds it is more difficult to... (4 Replies)
Discussion started by: i150371485
4 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I need a help with cut/awk command. I need to get certain values from a string provided. For example: i have a config file with below mentioned details
oracle="user=name"/"pass/word"@databasename.
I have used a command var1=`grep -w oracle sample.cfg | cut -d"=" -f2 | cut -d"/" -f1`.
... (10 Replies)
Discussion started by: kumars2102
10 Replies
7. UNIX for Advanced & Expert Users
Hi,
I want to add below line after end of a file (i.e file1)
&&echo "copy done" >> out.txt
cat file1
scp user1@server1:/tmp/dir /tmp/dir1
my requirment is
cat file1
scp user1@server1:/tmp/dir /tmp/dir1 &&echo "copy done" >> out.txt
could any one please help me (7 Replies)
Discussion started by: anshu ranjan
7 Replies
8. Shell Programming and Scripting
Hello All,
I am here again scratching my head on pattern selection with special characters.
I have a large file having around 200 entries and i have to select a single line based on a pattern.
I am able to do that:
Code:
cat mytest.txt | awk -F: '/myregex/ { print $2}'
... (6 Replies)
Discussion started by: usha rao
6 Replies
9. Shell Programming and Scripting
I'm very new to awk and sed and I've been struggling with this for a while.
I'm trying to search a file for a string with special characters and this string is a command line argument to a simple script.
./myscript "searchpattern" file
#!/bin/sh
awk "/$1/" $2 > dupelistfilter.txt
sed... (6 Replies)
Discussion started by: cue
6 Replies
10. Shell Programming and Scripting
Hi Everyone,
# cat 1.txt
1321631,77770132976455,19,20091001011859,20091001011907
1321631,77770132976455,19,20091001011859,20091001011907
1321631,77770132976455,19,20091001011859,20091001011907
# cat 1.txt | awk -F, '{OFS=",";print $1,$3,$4,$5}'
1321631,19,20091001011859,20091001011907... (7 Replies)
Discussion started by: jimmy_y
7 Replies