Sponsored Content
Full Discussion: AWK printing
Top Forums Shell Programming and Scripting AWK printing Post 302320948 by vgersh99 on Friday 29th of May 2009 11:25:58 AM
Old 05-29-2009
echo "123456789" | nawk -f splitBYchars.awk

splitBYchars.awk:
Code:
# echo "123456789" | nawk -f splitBYchars.awk
# assume input doesn't contain SUBSEP
BEGIN{
      FS=SUBSEP; OFS=" ";
}
{
   gsub(/./,"&" SUBSEP);sub(SUBSEP "$","");
   for(i=1; i<= NF; i++)
     printf("%s", (i != NF) ? $i OFS : $i "\n");
}

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

AWK printing

Hello, I am trying to write a formatted report into a file using .ksh script and awk. Here is the command I am trying to run echo "before awk" ${SRC_SCHEMA} echo | awk '{printf "%-20s", ${SRC_SCHEMA} }' >>$REPORT_SQL_NAME I get the following error before awk ADW awk: 0602-562 Field $()... (1 Reply)
Discussion started by: fastgoon
1 Replies

2. Shell Programming and Scripting

awk string printing

I am trying to print a line using awk printf command. The problem I am having is that when the string has spaces in between, it only prints the word upto the first space. For example, if my variable has "Hello World" The output is only "Hello". Here is the command I am using echo $recCtr... (2 Replies)
Discussion started by: fastgoon
2 Replies

3. Shell Programming and Scripting

Doubt in awk printing

Hi awk '/print/ {print }' format.txt the above code will search for the argument "print" and displays all the lines which contain "print" from format.txt i want to print the same but with # as teh beginning For eg: format.txt contains cat dog fire current print the value of 4 print... (2 Replies)
Discussion started by: jisha
2 Replies

4. Shell Programming and Scripting

printing and deleting using awk

I am trying to print and delete at the same time 0KB files... using following command a-> find . -type f | xargs ls -l | awk '{ if($5 == 0) {print $0;}}' | xargs rm $0 but am not successful. Can somebody tell me how to do this ... same time I need files to be printed as well deleted later. ... (4 Replies)
Discussion started by: vivek.gkp
4 Replies

5. Shell Programming and Scripting

AWK Printing

i have a file and i want to print the second variable and add qoutes to it i do awk -F"|" '{print $2}' star.unl. i get the output xxxxxxx but i need the variable($2) to be in quotes.like "xxxxxxx" how do i do there please (3 Replies)
Discussion started by: tomjones
3 Replies

6. Shell Programming and Scripting

Awk printing help

Hallo, i have a file which looks like this: $1 $2 $3 Student1 55 Pass 55 Pass 35 Fail Student2 55 Pass 55 Pass 35 Fail i want that the $1 field... (3 Replies)
Discussion started by: saint2006
3 Replies

7. Shell Programming and Scripting

Printing using awk

Hi I am relatively new to awk so i am getting confused a lot I am in need of help ... I am trying to append coloumns to the end of line using AWK I tried using this command awk -F "," '{for(s=7;s<=217;s++);$s="0";}1' OFS=, sam_sri_out It is giving me an output like this...... (1 Reply)
Discussion started by: Sri3001
1 Replies

8. UNIX for Dummies Questions & Answers

awk printing question

im using awk as a part of my tasks to filter out stuff for reporting details in our storage environment, supposed i filtered out these details (sorry, this might be long.) bash$ > for x in 1 2; do symdg show floras0-snap$x | awk '{print $3,$4}'; done : REGULAR in GNS Yes :... (10 Replies)
Discussion started by: prodigy06
10 Replies

9. Shell Programming and Scripting

Printing $values using awk

Hi All I had requirement where I need to re-order columns in a file by using a control file. here is the ctrl file c1 c2 c3 source file c3 | c1 | c2 a | b| c I should create output file based on the ctrl file columns o/p should look like this c1 | c2 | c3 b| c|a I wrote some... (9 Replies)
Discussion started by: gvkumar25
9 Replies

10. Shell Programming and Scripting

Printing awk outputs

Hello All, I have the following command which works partially: gzcat *2016-03-25_*gz | gawk -F"|" ' BEGIN{format = "%-10s %-13s %-17s %-35s\n"; printf format, "EVENT_TYPE","RESPONSE_CODE","INTERNAL_ERR_CODE","FLOWNAME"; printf format, "----------", "-------------", "-----------------",... (6 Replies)
Discussion started by: EAGL€
6 Replies
ucblinks(1B)					     SunOS/BSD Compatibility Package Commands					      ucblinks(1B)

NAME
ucblinks - adds /dev entries to give SunOS 4.x compatible names to SunOS 5.x devices SYNOPSIS
/usr/ucb/ucblinks [-e rulebase] [-r rootdir] DESCRIPTION
ucblinks creates symbolic links under the /dev directory for devices whose SunOS 5.x names differ from their SunOS 4.x names. Where possi- ble, these symbolic links point to the device's SunOS 5.x name rather than to the actual /devices entry. ucblinks does not remove unneeded compatibility links; these must be removed by hand. ucblinks should be called each time the system is reconfiguration-booted, after any new SunOS 5.x links that are needed have been created, since the reconfiguration may have resulted in more compatibility names being needed. In releases prior to SunOS 5.4, ucblinks used a nawk rule-base to construct the SunOS 4.x compatible names. ucblinks no longer uses nawk for the default operation, although nawk rule-bases can still be specifed with the -e option. The nawk rule-base equivalent to the SunOS 5.4 default operation can be found in /usr/ucblib/ucblinks.awk. OPTIONS
-e rulebase Specify rulebase as the file containing nawk(1) pattern-action statements. -r rootdir Specify rootdir as the directory under which dev and devices will be found, rather than the standard root directory /. FILES
/usr/ucblib/ucblinks.awk sample rule-base for compatibility links ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
devlinks(1M), disks(1M), ports(1M), tapes(1M), attributes(5) SunOS 5.10 13 Apr 1994 ucblinks(1B)
All times are GMT -4. The time now is 06:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy