10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
I have a multicolumn text file with header in the first row like this
The headers are stored in an array called . which contains I want to search for each elements of this array from that multicolumn text file. And I am using this awk approach
for ii in ${hdr}
do
gawk -vcol="$ii" -F... (1 Reply)
Discussion started by: Atta
1 Replies
2. Shell Programming and Scripting
echo {mbr_key,grp_key,dep_key,abc,xyz,aaa,ccc} |
awk 'gsub(/^|abc,|$/,"") {print}'
Required output
{grp_key,xyz,aaa,ccc} (5 Replies)
Discussion started by: 100bees
5 Replies
3. Shell Programming and Scripting
Hi,
I am trying below code but the word boundaries not seem to be working. What am I doing incorrectly?
echo " ECHO " | awk '{ q="ECHO" ; if ( $0 ~ /\bq\b/) print "HELLO" ; }'
OR
echo " ECHO " | awk '{ q="ECHO" ; if ( $0 ~ /\b'$q'\b/) print "HELLO" ; }'
Or
echo " ECHO " | awk... (6 Replies)
Discussion started by: ahmedwaseem2000
6 Replies
4. Shell Programming and Scripting
Hi,
I have around 10 files in a folder in which I want to change the file format from tab(\t) to pipe(|) with some changes in the fields as well. Below is the code, while tmp file is getting generated but move command is not working, please help
Following is the code
awk -F"\t" '{print... (2 Replies)
Discussion started by: siramitsharma
2 Replies
5. Shell Programming and Scripting
Hi,
i have a file that contains the following:
ARTPRD01_app =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 11.222.3.4)(PORT = 1540))
(CONNECT_DATA =
(SERVICE_NAME = artprd01.com)
ARTPRD01 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 11.223.3.1)(PORT =... (2 Replies)
Discussion started by: reignangel2003
2 Replies
6. Shell Programming and Scripting
Hello, everyone.
I am having trouble figuring out sed command which emulates uniq. The task I want to do is that 2 consecutive lines in file should be considered the same using the first word only. Example:
cat tmp.txt
ddd eee
aaa bbb ccc
ddd eee fff
asd fdd
asd fdd bbb
aaa bbb
asd fgh... (4 Replies)
Discussion started by: motorcek
4 Replies
7. UNIX for Dummies Questions & Answers
I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL.
I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies
8. Shell Programming and Scripting
Hi
I am writing a script using nano and I'm asking the user for their full name, I then store this in a variable but I only want to display the last word that they input. Any idea on how I would do this using awk. I am not using sed, just using a script. So far I have got this...
echo "What... (1 Reply)
Discussion started by: Addman1991
1 Replies
9. UNIX for Advanced & Expert Users
Hi,
Putting across a few awk expressions.
Apart from the last, all of them are working.
echo a/b/c | awk -F'/b/c$' '{print $1}'
a
echo a/b/c++ | awk -F'/b/c++' '{print $1}'
a
echo a/b/c++ | awk -F'/b/c++$' '{print $1}'
a/b/c++
Request thoughts on why putting a '$' post double ++... (12 Replies)
Discussion started by: vibhor_agarwali
12 Replies
10. UNIX for Dummies Questions & Answers
Hi All..I need a help i am trying to find a word using below script whereas the word exists in my file nitin.txt as a directory but still i am getting "word not found" output..Your suggestions welcomed.:
#to check for existence of nitin
#!/bin/bash
cd /apps/uat1/deploy/app
ls -lrt >... (4 Replies)
Discussion started by: nattynitin
4 Replies