עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

צמצום שורות בקובץ

Featured Replies

פורסם

היי,

אני מחפש פקודת shell או פונקציה בVI בשביל לצמצם שורות בקובץ (או סתם פלט).

לדוגמא, להפוך קובץ שבתוכו:

aa

bb

cc

dd

ל-

aabb

ccdd

לא מצאתי פקודה אחת שעושה את זה.

בתודה מראש,

יוני.

פורסם

לא יודע אם זה מובנה בשל, אבל אפשר, בכמה דקות, לכתוב פונקציה קצרה בסי שתעשה את זה...

פורסם

לא ברור מה אתה מנסה בדיוק להשיג

אבל נסה את הדבר הבא:


cat <file> | xargs -n 2 | awk '{ print $1""$2 }'

[root@rtbimages test]# cat er
aa
bb
cc
dd
ee
ff
gg
hh
ii
jj
oo
[root@rtbimages test]# cat er | xargs -n 2 | awk '{ print $1""$2 }'
aabb
ccdd
eeff
gghh
iijj
oo
[root@rtbimages test]#

פורסם
  • מחבר

ערן, תודה.

זה בדיוק מה שהייתי צריך.

בשביל לצמצם כל 3 שורות, פשוט להוסיף $3?

פורסם

תוכל לעשות זאת גם דרך פונקציה אם במקרה לא מותקן אצלך AWK.

cat <file> | while read first; do read second; echo "$first$second"; done

[root@rtbimages test]# cat er | while read first; do read second; echo "$first$second"; done
aabb
ccdd
eeff
gghh
iijj
oo
[root@rtbimages test]#

פורסם

בשביל לצמצם ל3 שורות תצטרך לשנות את הפקודה לזה:

xargs -n 3 | awk '{ print $1""$2""$3 }'

ובהתאמה ל4 שורות וכו'.

או כמובן דרך פונק'

while read first; do read second; read third; echo "$first$second$third"; done

פורסם
  • מחבר

מגניב אחי.

תודה על התגובה המהירה.

פורסם

חבר'ה, תודה שעזרתם. אמרתי לחבר שלי שיפתח משתמש כי יעזרו לו מהר אצלנו בפורום ולא התבדיתי :xyxthumbs:

פורסם

בכיף!

התקנה של כמה DATABASEים פה לוקחת יותר מידי זמן,

ומה יותר טוב להעביר את הזמן הזה מאשר פה? :)

זרוק זרוק עוד שאלות..

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.